dbexecute insert (Documentation Bugs and Problems)

by Jim ⌂ @, Russell, KY, Monday, June 09, 2014, 12:52 (1055 days ago) @ DickStomp

I totally missed one other statement that you need to execute BEFORE you can use SQL statements and that is the DBOPEN statement. You need to tell SQLite where the data will actually be stored.

dbopen "testdatabase.db"
dbexecute "create table dicktest1 (id integer, nummer text, value decimal);"
for n = 1 to 3
stmt$ = "insert into dicktest1 (id, nummer, value) values (" + n + ", '" + n + "', " + n + ");"
print stmt$
dbexecute stmt$
next n


dbopen "testdatabase.db"
dbopenset "select * from dicktest1 order by nummer;"
while dbrow()
print "?";
print dbint(0) + dbstring(1) + dbfloat(2)
end while
print "einde"

When you run the code you will see a file (where you saved the program) called "testdatabase.db" that actually contains the database tables and rows.


Complete thread:

 RSS Feed of thread

powered by my little forum