i got sql syntax error when i debug my application..

Posted by newBie on Stack Overflow See other posts from Stack Overflow or by newBie
Published on 2010-06-10T09:38:32Z Indexed on 2010/06/10 9:42 UTC
Read the original article Hit count: 189

Filed under:
|

hi..i want to update my database using formatsqlparam..but when i debug it, it has error saying

"Incorrect syntax near ','."

this is my code:

    Dim sql2 As String = "update infoHotel set nameHotel = N" & FormatSqlParam(hotel) & _
                                                       ", knownAs1 = N" & FormatSqlParam(KnownAs(0)) & _
                                                       ", knownAs2 = N" & FormatSqlParam(KnownAs(1)) & _
                                                       ", knownAs3 = N" & FormatSqlParam(KnownAs(2)) & _
                                                       ", knownAs4 = N" & FormatSqlParam(KnownAs(3)) & _
                                                       ", streetAddress = N" & FormatSqlParam(StreetAddress) & _
                                                       ", locality = N" & FormatSqlParam(Locality) & _
                                                       ", postalCode = N" & FormatSqlParam(PostalCode) & _
                                                       ", country = N" & FormatSqlParam(Country) & _
                                                       ", addressFull = N" & FormatSqlParam(address) & _
                                                       ", tel = N" & FormatSqlParam(contact) & ","

    Dim objCommand3 As New SqlCommand(sql2, conn)
    objCommand3.ExecuteNonQuery()

maybe i missing some syntax..but couldnt find where it is..hope somebody can help..thnks in advance..im using vb.net and sql

© Stack Overflow or respective owner

Related posts about sql

Related posts about vb.net