Что нового

[Данные, строки] sqlite не хочет писать в файл

les100

Новичок
Сообщения
1
Репутация
0
чего то не хочет open писать в файл, получается db с 0-ым размером

Код:
Local $DBase = _SQLite_Open("mumu_sql.db")
If @error Then
    MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!")
    Exit -1
EndIf


If Not _SQLite_Exec($DBase, "CREATE TEMP TABLE persons (Name, Age);") = $SQLITE_OK Then _
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg())
If Not _SQLite_Exec($DBase, "INSERT INTO persons VALUES ('Alice','43');") = $SQLITE_OK Then _
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg())
If Not _SQLite_Exec($DBase, "INSERT INTO persons VALUES ('Bob','28');") = $SQLITE_OK Then _
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg())
If Not _SQLite_Exec($DBase, "INSERT INTO persons VALUES ('Cindy','21');") = $SQLITE_OK Then _
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg())

_SQLite_GetTable(-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns)
_SQLite_Close("mumu_sql.db") ;ладно, закрываем..........
 MsgBox(0, "Oki?", "Вроде прокатило")

$DBase = _SQLite_Open("mumu_sql.db");открываем..........
If @error Then
    MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!")
    Exit -1
EndIf
_SQLite_GetTable(-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns);идем нах.......
_SQLite_Close("mumu_sql.db")
 MsgBox(0, "Oki?", "Них не прокатило")


_SQLite_Shutdown()


Используйте для AutoIt кода тег [autoit]

madmasles.
 

madmasles

Модератор
Глобальный модератор
Сообщения
7 790
Репутация
2 319
les100,
Код:
#include <SQLite.au3>

_SQLite_Startup()

Local $aResult, $iRows, $iColumns
If FileExists(@ScriptDir & "\mumu_sql.db") Then FileDelete(@ScriptDir & "\mumu_sql.db")
Local $hBase = _SQLite_Open(@ScriptDir & "\mumu_sql.db")
If @error Then Exit ConsoleWrite("Can't Load Database!" & @LF)

If _SQLite_Exec($hBase, "CREATE TABLE persons (Name, Age);") Then Exit ConsoleWrite(_SQLite_ErrMsg() & @LF)
If _SQLite_Exec($hBase, "INSERT INTO persons VALUES ('Alice','43');") Then Exit ConsoleWrite(_SQLite_ErrMsg() & @LF)
If _SQLite_Exec($hBase, "INSERT INTO persons VALUES ('Bob','28');") Then Exit ConsoleWrite(_SQLite_ErrMsg() & @LF)
If _SQLite_Exec($hBase, "INSERT INTO persons VALUES ('Cindy','21');") Then Exit ConsoleWrite(_SQLite_ErrMsg() & @LF)

_SQLite_GetTable(-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns)
_ArrayDisplay($aResult, 1)
_SQLite_Close($hBase)

$hBase = _SQLite_Open(@ScriptDir & "\mumu_sql.db")
If @error Then Exit ConsoleWrite("Can't Load Database!" & @LF)

_SQLite_GetTable(-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns)
_ArrayDisplay($aResult, 2)
_SQLite_Close($hBase)
_SQLite_Shutdown()
 
Верх