PDA

View Full Version : Invalid column name



flann
Aug 31st, 2005, 05:58 PM
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?

nikkiH
Aug 31st, 2005, 07:38 PM
I believe you need single (or double, depending on DBMS) quotes.

OutJudgements = '" & judgement & "' WHERE

flann
Aug 31st, 2005, 09:55 PM
thank you, that did work.