Helpful Information
 
 
Category: ASP.NET
Invalid column name

I'm trying to update a sql database field with a string value. I'm getting a wierd error saying "Invalid column name 'NO'". The field that I'm trying to update is just simply the value out of a dropdownlist, and the two values are 'yes' and 'no'. Here is my update statement.


Dim sqlcommand As New SqlCommand
Dim judgement As String = ddlLegal.SelectedValue
sqlcommand.Connection = connPayables
sqlcommand.CommandText = "UPDATE ClientInfo SET OutJudgements = " & judgement & " WHERE LeadID = " & intLeadid
connPayables.Open()
sqlcommand.ExecuteNonQuery()
connPayables.Close()

I know that the variable "judgement" is holding the correct value, what could be causeing my error?

I believe you need single (or double, depending on DBMS) quotes.

OutJudgements = '" & judgement & "' WHERE

thank you, that did work.










privacy (GDPR)