S
someone
I am using the following code in response to a button press.
SqlConnection sqlConn;
SqlCommand sqlCmd;
sqlUpdate = "update ACCGreatest set Votes = (select Votes
+ 1 from ACCGreatest where PlayerID = " +
Convert.ToInt32(ddlGreatest.SelectedItem.Value.ToString()) + ") where
PlayerID = " + Convert.ToInt32(ddlGreatest.SelectedItem.Value);
sqlConn = new
SqlConnection("server=(local);uid=accfb;password=accrules;database=ACCFB");
sqlCmd = new SqlCommand(sqlUpdate, sqlConn);
sqlConn.Open();
try
{
sqlCmd.ExecuteNonQuery();
}
catch(SqlException ae)
{
Response.Write("SQL Exception: " + ae.ToString());
}
sqlConn.Close();
Unfortunately, it is not working. Can anyone see why this would be
happening? I can take the update string and use it in the SQL Analyzer
and it works fine. So what gives?
TIA,
Mike
SqlConnection sqlConn;
SqlCommand sqlCmd;
sqlUpdate = "update ACCGreatest set Votes = (select Votes
+ 1 from ACCGreatest where PlayerID = " +
Convert.ToInt32(ddlGreatest.SelectedItem.Value.ToString()) + ") where
PlayerID = " + Convert.ToInt32(ddlGreatest.SelectedItem.Value);
sqlConn = new
SqlConnection("server=(local);uid=accfb;password=accrules;database=ACCFB");
sqlCmd = new SqlCommand(sqlUpdate, sqlConn);
sqlConn.Open();
try
{
sqlCmd.ExecuteNonQuery();
}
catch(SqlException ae)
{
Response.Write("SQL Exception: " + ae.ToString());
}
sqlConn.Close();
Unfortunately, it is not working. Can anyone see why this would be
happening? I can take the update string and use it in the SQL Analyzer
and it works fine. So what gives?
TIA,
Mike