SQL Error 42s22

Hi,

I'm trying to upload variable tag data from citect SCADA.

SQL error 42s22 happens when I try to upload a string data to the database using cicode, SQLSet and SQLAppend, but works fine with integer variables.

Please suggest any solution to this.

Parents
  • Following is the parts of the  cicode

      STRING st1=IntToStr(VAR1);

      STRING st2=IntToStr(VAR2);    

      STRING st3=IntToStr(VAR3)

    {

    SQL Connection Block

    }

         SQLSet(hSQL, "INSERT INTO TABLE1 (Tag1,tag2,tag3,tag4)VALUES(");

         SQLAppend(hSQL, st1+","+st2+","+st3+",'Test string')"); 

    {

    Code for error message,

    code for SQl disconnection

    }

    This code works perfect!

    Now I need to update the tag4 data in the database with a string variable. I tried using the same format in the VALUES "+VAR4+" , but it returned 42s22 error.

    Also i tried with assigning it to a string variable 'st4' and tried loading to the database using "+st4+", even this returned the same error, 42s22 Invalid column name.

    Thanks

    Bhadresh.

Reply
  • Following is the parts of the  cicode

      STRING st1=IntToStr(VAR1);

      STRING st2=IntToStr(VAR2);    

      STRING st3=IntToStr(VAR3)

    {

    SQL Connection Block

    }

         SQLSet(hSQL, "INSERT INTO TABLE1 (Tag1,tag2,tag3,tag4)VALUES(");

         SQLAppend(hSQL, st1+","+st2+","+st3+",'Test string')"); 

    {

    Code for error message,

    code for SQl disconnection

    }

    This code works perfect!

    Now I need to update the tag4 data in the database with a string variable. I tried using the same format in the VALUES "+VAR4+" , but it returned 42s22 error.

    Also i tried with assigning it to a string variable 'st4' and tried loading to the database using "+st4+", even this returned the same error, 42s22 Invalid column name.

    Thanks

    Bhadresh.

Children
No Data