Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Syntax Error with Database UPDATE SQL
I am using the UPDATE command using ADO.Net to connect to a SQL Server and I get an error. I am not sure if the problem is in my database table code or in my UPDATE command. Here is my code:
Dim strImageFN = OpenFileDialog1.FileName
Dim sqlUpdate As New SqlClient.SqlCommand("Update TableName Set" & _
" ColumnName = " & strImageFN & " WHERE ID = 1", Database)
The code in red is where I get my runtime error that says:
syntax error around 'D:'
I checked my code that created the table and I made sure that the column is set to [blue]varchar(50)[/blue] so I don't see where my error is. I don't believe it is in the table because if write the text of the variable into the ColumnName it works fine but once I have the variable in there it gives me the error message. Thanks for your time!