c - How to update a SQL Server database from Labwindows CVI -
i trying update sql server database cvi. have code:
update [ebob].[dbo].[tblvessel] set [ebob].[dbo].[tblvessel].[contents] = [labic].[dbo].[tolvassabamex2].[material] [labic].[dbo].[tolvassabamex2] [ebob].[dbo].[tblvessel].[vesselid] = [labic].[dbo].[tolvassabamex2].[id]
i use code sql server , works, when used in cvi not update:
int cvicallback actualizar_i (int panel, int control, int event, void *callbackdata, int eventdata1, int eventdata2) { switch (event) { case event_commit: conexion2(); int tolva; char material[26]; //float valor; getctrlval(panel, panel_2_ring, &tolva); getctrlval(panel, panel_2_string, &material[0]); //getctrlval(panel, panel_2_numeric, &valor); char comando[500]={0}; sprintf(comando, "update tolvassabamex2 set contents = %s id = %u", material, tolva); int hstmt; hstmt=dbpreparesql(hdbc, comando); dbexecutepreparedsql (hstmt); //sprintf(comando2"update [ebob].[dbo].[tblvessel] set [ebob].[dbo].[tblvessel].[contents] = [labic].[dbo].[tolvassabamex2].[material] [labic].[dbo].[tolvassabamex2] [ebob].[dbo].[tblvessel].[vesselid] = [labic].[dbo].[tolvassabamex2].[id]"); break; } //update [labic].[dbo].[tolvassabamex2] set contents = %s [labic].[dbo].[tolvassabamex2].[id] = %u", material, tolva return 0;
and been using following commands sqltoolkit cvi not work dbpreparesql, dbactivatesql
Comments
Post a Comment