A very basic (read: noob) sqlite question

Just starting out? Need help? Post your questions and find answers here.
IndiQa
New User
New User
Posts: 7
Joined: Thu Jan 22, 2009 4:41 pm
Location: US

A very basic (read: noob) sqlite question

Post by IndiQa »

Yes I am a complete db noob.

Am trying to use the sqlite db functions in PB.

I have a sqlite db with table created.

How do I put the data which is in a string variable into the table?

This works:
CheckDatabaseUpdate(0, "INSERT INTO food (name, weight) VALUES ('apple', '10')")


OK I now have the text 'apple' contained in a string variable say A.s or A$

how do I put A$ into the table?

I can verify what works and doesn't work in the database with the sqlitebrowser application.


Thanks,

Curt
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

>> how do I put A$ into the table?

Code: Select all

A$ = "apple"
sql.s = "INSERT INTO food (name, weight) VALUES ('" + A$ + "', '10')"
CheckDatabaseUpdate(0, sql) 
greetings
thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
IndiQa
New User
New User
Posts: 7
Joined: Thu Jan 22, 2009 4:41 pm
Location: US

Post by IndiQa »

Thanks man I do appreciate it.

I knew it was simple and now maybe I am a little less...simple that is :-)

Curt
IndiQa
New User
New User
Posts: 7
Joined: Thu Jan 22, 2009 4:41 pm
Location: US

Post by IndiQa »

One other question:

Never mind got it!!

Syntax is my downfall..

Thanks,
Curt
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply