给你个写入到TXT的
#include <SQLITE.au3>
#include <SQLITE.dll.au3>
_SQLite_Startup()
Global $hQuery, $aRow
$path = @ScriptDir & "\test.txt"
$sqlpath = @ScriptDir & "\test.db"
$sqlname = "test"
$scr = MsgBox(1, "例子", "是否写入")
If $scr = 1 Then
If FileExists($path) Then
FileDelete($path)
EndIf
If FileExists($sqlpath) Then
sqlcreate()
EndIf
sql()
Else
_SQLite_Shutdown()
Exit
EndIf
Func sqlcreate() ;==>创建
_SQLite_Open($sqlpath)
_SQLite_Exec(-1, "Create Table IF NOT Exists " & $sqlname & " (test1 VARCHAR(255) PRIMARY KEY not null,test2 VARCHAR(255),test3 VARCHAR(255));")
_SQLite_Exec(-1, "Insert into " & $sqlname & " values ('1','2','3');")
_SQLite_Exec(-1, "Insert into " & $sqlname & " values ('只是','个','例子');")
_SQLite_Exec(-1, "Insert into " & $sqlname & " values ('不能为空的主键','','');")
_SQLite_Close()
EndFunc ;==>sqlcreate
Func sql() ;==>读取并写入
_SQLite_Open($sqlpath)
_SQLite_Query(-1, "SELECT * FROM " & $sqlname & " ORDER BY test1;", $hQuery)
While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
FileWrite($path, $aRow[0] & "|" & $aRow[1] & "|" & $aRow[2] & @CRLF)
WEnd
_SQLite_Close()
_SQLite_Shutdown()
EndFunc ;==>sql
|