String Value in a SQL statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kalkin
    New Member
    • Nov 2009
    • 6

    String Value in a SQL statement

    Hi

    I am trying to get data from my database using a string value, but keep getting an error message "Value of type string cannot be converted to system.data.dat aset"

    The code is:

    strRetailTenant Type = Replace(dstReta ilTenantType.Ta bles(0).Rows(0) .Item(0), " ", "")
    dstRentalIndex = ("Select " & strRetailTenant Type.Trim & " from tbl_RentalEscIn dex where projID = " & Me.lblProjIDent .Text.Trim & " and IndexYear = " & intRentalIndex & " ")


    any help would be much appreciated.
    thanks in advance
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    It sound like you are trying to convert something into a String that is not a string and cannot be converted into one. In fact it sounds like you are trying to do this to your DataSet....

    What is stored in:
    dstRetailTenant Type.Tables(0). Rows(0).Item(0)



    -Frinny

    Comment

    • Prasadsm
      New Member
      • Nov 2008
      • 14

      #3
      Try using this....

      Replace(dstReta ilTenantType.Ta bles(0).Rows(0) .Item (0).Tostring(), " ", "")

      Comment

      Working...