Sign in to follow this  
Followers 0
faustf

sqlite delete record

6 posts in this topic

hi guy

if i want remove specific record in table is correct if i use this sintax

$iocr1 = _GUICtrlListView_GetItemTextArray($List1AC)

_SQLite_Query($Db,"DELETE FROM anagrafica WHERE ana_id"&$iocr1[8]&";",$hQuery)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

A query is ... well, a query. Use a query with "select ... from ... where ...".

Also I already advised you to stop using low-level _SQLite_* functions and favor _SQLite_GetTable[2d] instead for querying the DB.

But since you need to delete row(s) here, use _SQLite_Exec like this (with an equal sign in the where condition!):

_SQLite_Exec($hDB, "delete from anagrafica where ana_id = " & $myvariable)
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)

Share this post


Link to post
Share on other sites

i try to do in this mode but dont go :(

Func _elimina_cliente()
$dir_clienti=''
$apri_folder=''
$iocr1 =''
$iocr1 = _GUICtrlListView_GetItemTextArray($List1AC)

_SQL_Startup()

$Db=_SQLite_Open($percorso_Db); Open a permanent disk database
If @error Then
MsgBox(16+262144, "SQLite Error", "Non posso creare il Database!")
Exit -1
EndIf

_SQLite_Query($Db,"DELETE FROM anagrafica WHERE ana_id = "&$iocr1[8]&";",$hQuery)
If @error Then
MsgBox(16+262144, "SQLite Error", "Non posso cancellare il record nel database!")
;Exit -1
EndIf

_SQLite_Close()
_SQLite_Shutdown()
EndFunc

Share this post


Link to post
Share on other sites

faustf,

Re-read jchd's post...


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

o yea i am fuse so sorry :(:)

Share this post


Link to post
Share on other sites

Of course you can read and see that the word query is different from the word exec. Just like my previous post strongly hinted to.

Of course you can probably devise that $myvariable can be changed to the actual variable you need in your context.

What I find surprising is that you consider SQLite so much more difficult than MySQL. At this rate, every SQL engine is going to be hard to you.


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)

Share this post


Link to post
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
Sign in to follow this  
Followers 0