|
Post by votan on Jul 20, 2008 5:24:56 GMT -5
I need to write a numeric variable into a numeric DB field... but for some reason it does not work.. So for example... I create a variable "variablex = 32" then I want to insert that variable into a DB like this "insert into DB (the_variable) values (variableX)" I already tried all sorts of syntax on that, but always either got an error (like "no such column: variablex" or the "the_variable" field got filled with the the name of the variable.. so filled with "variablex" instead of its value even though the field is set to "numeric". Just need the syntax to finally insert the value of variablex into the DB by using the variable name.... It works when I treat the numeric value as a string... but that's not really how it should be.... Any help is welcome....
|
|
|
Post by Janet on Jul 20, 2008 8:49:03 GMT -5
Check your syntax. Variables are case sensitive. You have one place where you type variablex and another where you type variableX Might just be a typo in your posting here and not in your code, but it may be worth checking out.
|
|
|
Post by votan on Jul 20, 2008 10:06:54 GMT -5
That was just a typo in the example.... it's all ok in the script. But anyway, it does not work. For now I guess I have to treat it as a string and use val(variablex$) to perform operations on it...
|
|
|
Post by kokenge on Jul 20, 2008 10:20:36 GMT -5
If you create a sql command like this
sql$ = "insert into DBtable (the_variable) values (variableX)" you realize you will not substitute the value into variableX
However if you variableX = 32 sql$ = "insert into DBtable (the_variable) values (";variableX;")" This will substitute 32 into the variableX
One thing you will find is that there are errors in SQLite itself. Especially when trying to create an index.
|
|
|
Post by votan on Jul 20, 2008 16:15:55 GMT -5
Great, thanks! Getting to know all the syntaxing is the hardest thing for me....
|
|