I've been having a lot of trouble with these simple lines of code. I tried fixing it many times, but I don't seem to get it. I hope someone can help me with this.
SqlCommand cmd = new SqlCommand("UPDATE dbo.Status SET Status = "<span class=\"label label-success\">Success</span>" WHERE ActivateMember = " +i + "",
mydatabase.cn);
The problem is I'm unable to execute that SqlCommand in C# but I'm able to execute it as a SQL query.
Right now the error is
Unexpected character '\'
"'<span class=\"label label-success\">Success</span>'"but you should really use parameterized queries instead to prevent SQL injection attacks.