LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

update data base through variable

Solved!
Go to solution

hi,

could you please suggest how to insert data in to data base through variable, i have used code like this:

 

resCode = DBImmediateSQL(hdbc, "INSERT INTO table1(highlimit,lowlimit)  VALUES (mes1,mes2)");

 

but i am getting error like too few parameters expected2. do i need to use another function for using variable.

 

Thanks & Regards

 

 

0 Kudos
Message 1 of 2
(2,716 Views)
Solution
Accepted by topic author bharadwaja

If you pass the string "INSERT INTO table1(highlimit,lowlimit)  VALUES (mes1,mes2)", mes1 and mes2 are not subsituted with their values if they are variables. You need first to build the string you are passing to DBImmediateSQL e.g:

char sql_cmd[200];

sprintf (sql_cmd, "INSERT INTO table1(highlimit,lowlimit)  VALUES (%f,%f)", mes1, mes2);
resCode = DBImmediateSQL(hdbc, sql_cmd);

 

You may have a look on this post with the same problem

0 Kudos
Message 2 of 2
(2,708 Views)