I have a wonderware standalone HMI collecting process data from our production line. I am writing those values to a database in MySQL, though I did start playing with it in MS Access at first.
The problem is the two different insert options.
When I use the SQLInsert function, no errors, everything works fine. When I use the SQLInsertPrepare and SQLInsertExecute functions, it gives me item cannot be found in the requested ordinal error.
This is the script I am using for the insert by itself that works without problem
ResultCodePreparL1O = SQLInsert(Quad_Connection, "STR1_Overview_Report" , "STR1_Overview");
ResultCodePreparL1B = SQLInsert(Quad_Connection, "STR1_Bronx_Report" , "STR1_Bronx" );
ResultCodePreparL1N = SQLInsert(Quad_Connection, "STR1_NDT_Report" , "STR1_NDT");
And this is the script I am using for the insert prepare and execute that is giving me errors
ResultCodePreparL1O = SQLInsertPrepare(Quad_Connection, "STR1_Overview_Report" , "STR1_Overview" , STR1_OV_State);
ResultCodeInsertL1O = SQLInsertExecute(Quad_Connection, "STR1_Overview" , STR1_OV_State);
ResultCodeEndL1O = SQLInsertEnd(Quad_Connection, STR1_OV_State);
ResultCodePreparL1B = SQLInsertPrepare(Quad_Connection, "STR1_Bronx_Report" , "STR1_Bronx" , STR1_Bronx_State);
ResultCodeInsertL1B = SQLInsertExecute(Quad_Connection, "STR1_Bronx" , STR1_Bronx_State);
ResultCodeEndL1B = SQLInsertEnd(Quad_Connection, STR1_Bronx_State);
ResultCodePreparL1N = SQLInsertPrepare(Quad_Connection, "STR1_NDT_Report" , "STR1_NDT" , STR1_NDT_State);
ResultCodeInsertL1N = SQLInsertExecute(Quad_Connection, "STR1_NDT" , STR1_NDT_State);
ResultCodeEndL1N = SQLInsertEnd(Quad_Connection, STR1_NDT_State);
I get the same error and success in both MySQL and Access with these different scripts.
I am thinking it has to be something in the table name and bindlist, but I dont understand how it works just fine with the straight insert command.
**Edit**
Also, the prepare and end commands return with no errors. It is the InsertExecute command that is giving the actual error.
The problem is the two different insert options.
When I use the SQLInsert function, no errors, everything works fine. When I use the SQLInsertPrepare and SQLInsertExecute functions, it gives me item cannot be found in the requested ordinal error.
This is the script I am using for the insert by itself that works without problem
ResultCodePreparL1O = SQLInsert(Quad_Connection, "STR1_Overview_Report" , "STR1_Overview");
ResultCodePreparL1B = SQLInsert(Quad_Connection, "STR1_Bronx_Report" , "STR1_Bronx" );
ResultCodePreparL1N = SQLInsert(Quad_Connection, "STR1_NDT_Report" , "STR1_NDT");
And this is the script I am using for the insert prepare and execute that is giving me errors
ResultCodePreparL1O = SQLInsertPrepare(Quad_Connection, "STR1_Overview_Report" , "STR1_Overview" , STR1_OV_State);
ResultCodeInsertL1O = SQLInsertExecute(Quad_Connection, "STR1_Overview" , STR1_OV_State);
ResultCodeEndL1O = SQLInsertEnd(Quad_Connection, STR1_OV_State);
ResultCodePreparL1B = SQLInsertPrepare(Quad_Connection, "STR1_Bronx_Report" , "STR1_Bronx" , STR1_Bronx_State);
ResultCodeInsertL1B = SQLInsertExecute(Quad_Connection, "STR1_Bronx" , STR1_Bronx_State);
ResultCodeEndL1B = SQLInsertEnd(Quad_Connection, STR1_Bronx_State);
ResultCodePreparL1N = SQLInsertPrepare(Quad_Connection, "STR1_NDT_Report" , "STR1_NDT" , STR1_NDT_State);
ResultCodeInsertL1N = SQLInsertExecute(Quad_Connection, "STR1_NDT" , STR1_NDT_State);
ResultCodeEndL1N = SQLInsertEnd(Quad_Connection, STR1_NDT_State);
I get the same error and success in both MySQL and Access with these different scripts.
I am thinking it has to be something in the table name and bindlist, but I dont understand how it works just fine with the straight insert command.
**Edit**
Also, the prepare and end commands return with no errors. It is the InsertExecute command that is giving the actual error.
Last edited: