locked
Input string was not in a correct format / DataTable.Select RRS feed

  • Question

  • User-937918033 posted

    Hi I have a problem, when I am trying to use DataTable.Select to get column values..  Actually it is working file in C# which I have converted using Converters.


    I am using .NET 1.1 / VS 2003...

      DataRow[] drs = dtResults.Select("ISSD" + i + " =" + issd+" AND BiPad ="+bipa

     input string was not in correct format..

    
    
    Line 175:        While i <= 8
    Line 176:
    Line 177:            Dim drs As DataRow() = dtResults.[Select]("ISSD" + i + " =" + issd + " AND BiPad=" + bipad)
    Line 178:
    Line 179:

    Any help would be much thankful...


    Friday, February 5, 2010 12:25 PM

Answers

  • User-1149223197 posted

    In the database, what are the column types for ISSD0, ISSD1, ISSD2, ISSD3, ISSD4, ISSD5, ISSD6, ISSD7, ISSD8, and BiPad? Are they varchar or int?

     Dim drs As DataRow() = dtResults.[Select]("ISSD" + i + " = '" + issd + "' AND BiPad = '" + bipad + "'")

    Notice how I added single quotes around the input string select parameters. This is necessary if your db columns are varchar.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 5, 2010 1:08 PM
  • User-379429695 posted

    try this instead (adding single quotes around = 'value'  adding spaces after and before equals signs):

     Dim drs As DataRow() = dtResults.[Select]("ISSD" + i + " = '" + issd + "' AND BiPad = '" + bipad + "'")

     

    also, verify that issd and bipad are not null variables.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 5, 2010 2:46 PM

All replies

  • User-1149223197 posted

    In the database, what are the column types for ISSD0, ISSD1, ISSD2, ISSD3, ISSD4, ISSD5, ISSD6, ISSD7, ISSD8, and BiPad? Are they varchar or int?

     Dim drs As DataRow() = dtResults.[Select]("ISSD" + i + " = '" + issd + "' AND BiPad = '" + bipad + "'")

    Notice how I added single quotes around the input string select parameters. This is necessary if your db columns are varchar.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 5, 2010 1:08 PM
  • User-379429695 posted

    try this instead (adding single quotes around = 'value'  adding spaces after and before equals signs):

     Dim drs As DataRow() = dtResults.[Select]("ISSD" + i + " = '" + issd + "' AND BiPad = '" + bipad + "'")

     

    also, verify that issd and bipad are not null variables.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 5, 2010 2:46 PM