Reputation: 157
I have this code on C#
and I got NoIDStaffC from
NoIDStaffC = dataGridView3.Rows[e.RowIndex].Cells[0].Value.ToString();
Every time I try to run it, it keep telling me that SqlException
was unhandled.
And this is my table in SQL Server :
Upvotes: 0
Views: 85
Reputation: 5649
The problem you're seeing is because A002
isn't quoted in the query - so it's being treated as a column name instead of text to compare with.
You can either add single quotes around it in your built string or parameterize your query (preferred) to fix the problem.
Upvotes: 2