Jump to content

How to insert into SQLite database?


Recommended Posts

I tried to copy some script from somewhere, then modify it like this:
 

#include <Array.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>

_SQLite_Startup(@ScriptDir & "\" & "sqlite3.dll", False, 1)
If @error Then
    MsgBox(16, "SQLite Error", "SQLite3.dll Can't be Loaded! - " & $__g_hPrintCallback_SQLite & @CRLF & @CRLF & "Exiting application")
    Exit -1
EndIf

Local $sDatabase = @ScriptDir & "\" & "Funfield_Database.db"
Local $hDatabase = _SQLite_Open($sDatabase)

_SQLite_Exec($hDatabase, 'insert into Transaction_Report (Chat_Name, Transfer_Name, Payment_Method) Values ("John", "Doe", "Paypal")')

_SQLite_Close($hDatabase)
_SQLite_Shutdown()


But then, nothing happened

Where should I put SQLite.au3 and SQLite.dll.au3?
I currently put it inside include folder in autoit folder

Where should I put sqlite3.dll and sqlite3_x64.dll?
I currently put it inside this script folder

Link to comment
Share on other sites

  • Developers
4 minutes ago, HezzelQuartz said:

But then, nothing happened

What does that exactly mean?

Also add return/@error tests after each performed function to check what is failing!

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

21 minutes ago, Jos said:

What does that exactly mean?

Also add return/@error tests after each performed function to check what is failing!

The Value I tried to add is not added into my database

Nothing happened to my database, Nothing was added

What function should I use to add a row of value to my database?

Link to comment
Share on other sites

Again follow @Jos' advice and add @error checking after every SQLite function call, ConsoleWrite anything != 0.

Use sqlite3.dll if compiling for x86 or sqlite3_x64.dll when compiling for x64.

Also string literals in SQL (and SQLite as well) use single quotes; double quotes are reserved for schema names.

Remove line

#include <SQLite.dll.au3>
Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...