I am making a voting system. I have a problem adding a count(increment each time the candidate is voted) to each candidate that they voted.
My Vote Button code is :
sc.Open();
try
{
cmd = new SqlCommand("UPDATE TableVote SET Vcount=Vcount+1 WHERE id=@count", sc);
cmd.Parameters.AddWithValue("@count", TxtPresID.Text);
int res = cmd.ExecuteNonQuery();
if (res > 0)
{
MessageBox.Show(TxtPresID.Text.ToString() + " Saved!");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
sc.Close();
}
and my table is

the result of Vcount is just NULL..

What am i doing wrong? or is my Sql statement correct?
Vcount=ISNULL(Vcount,0)+1NULLat all. Something that doesn't have any votes against it would have a vote count of 0, notnull!