5
Answers

How to fix update error?

Ask a question
Black Diamond

Black Diamond

13y
1.3k
1
Hi everyone,

I hava a code to update sql table, but when i look at the table nothings happen its empty this is my code:

Vote = count.ToString();
conn.Open();
CountUpdate.Parameters.Add(SqlCommand CountUpdate = new SqlCommand("UPDATE FinalVotes SET Name='"+btnCandidates1.Text+"' where Votes='"+Vote+"'", conn);
CountUpdate.Parameters.Add("@Name", SqlDbType.VarChar,100).Value=DBNull.Value;"@Votes", SqlDbType.VarChar,100).Value =DBNull .Value;


CountUpdate.ExecuteNonQuery();


conn.Close();


please help me out this problem...thanks





Answers (5)