how to make condition to update table ?
- by newBie
hi..i want to make condition to update my table if there's already same data (in the same column) inserted in the table.
im using
If String.ReferenceEquals(hotel, hotel) = False Then
insertDatabase()
Else
updateDatabase()
End If
this is the updateDatabase() 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)) & _
" where hotel = " & hotel & ")"
the function manage to go into updateDatabase() but has some error saying
"Incorrect syntax near 'Oriental'."
Oriental is the data inserted in the table. is it suitable to use ReferenceEquals?
im using vb.net and sql database..tq