Column does not exist - InfoPath Dev
in

InfoPath Dev

Column does not exist

Last post 07-30-2010 04:21 AM by alexia_net. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-30-2010 02:16 AM

    Column does not exist

    Hi. I am trying to extract some info from an sql database using code.

                objSqlDT.Reset();
                objSqlDA.Fill(objSqlDT);
                intNrRecords = objSqlDT.Rows.Count;
                tmp_strTemp_Matr = new string[intNrRecords, tmp_strTempFields_Vect.Length];

     

                for (int j = 0; j < intNrRecords; j++)
                {
                    for (int k = 0; k < tmp_strTempFields_Vect.Length; k++)
                    {
                        //tmp_strTemp_Matr[j, k] = objSqlDT.Rows[j][tmp_strTempFields_Vec[k]].ToString();
                        strColoana = tmp_strTempFields_Vect[k];
                        tmp_strTemp_Matr[j, k] = objSqlDT.Rows[j][strColoana].ToString();
                    }
                }

     

      tmp_strTempFields_Vect[k]; contains the name of the fields for which I extract the information.

    tmp_strTemp_Matr[j, k] is the matrix which contains all the information for the fielda above.

    The thing is that the program generates an error when it reaches this line

     tmp_strTemp_Matr[j, k] = objSqlDT.Rows[j][strColoana].ToString();

    it generates this error:

    An error occured: 'Column 'nameTypeDevice' does not belong to table .'

    Of course, it's false  , the columns is there, I do not understand why the value cannot be inserted into the matrix.

    Thank you!

  • 07-30-2010 04:21 AM In reply to

    The problem was that in the sql command, when using variables you must call them like

    " + variable + "

    not like

    ' " + varaiable + " '

     

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.