Hi.. I want to update my database using formatsqlparam, but when I debug it, it has an 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 am missing some syntax, but I couldn't find where it is. I hope somebody can help. Thanks in advance. I'm using VB.Net and SQL.