August 5, 2012 at 8:57 pm
Hi,
1)How to resolve this problem " Must declare the scalar variable "@UPDATE".
myConnection = db.getConnection();
DataSet ds = new DataSet();
SqlDataAdapter myAdaptor = new SqlDataAdapter();
SqlCommand Cmd = new SqlCommand();
string year = ddl_AcadYear.SelectedValue;
string period = ddl_AcadPeriod.SelectedValue;
string course = gv_refresh.Columns[0].ToString();
//Cmd.Connection = myConnection;
Cmd.Connection = myConnection;
string sql = "@UPDATE StudNumIPP SET NofStud = '" + noOfStud + "', DBI_IT_Track = '" + dbiItTrack + "', DBI_Biz_Track = '" + dbiBizTrack + "' where acadYear = '" + year + "' AND acadPeriod = '" + period + "' AND Course ='" + course + "' ";
Cmd.CommandText = sql;
myConnection.Open();
Cmd.ExecuteNonQuery();
myConnection.Close();
Thanks.
August 5, 2012 at 9:59 pm
I think you are trying to update a table and using @update (which is used for variables) instead of update
use this (i just delate @ infront of UPDATE)
string sql = "UPDATE StudNumIPP SET NofStud = '" + noOfStud + "', DBI_IT_Track = '" + dbiItTrack + "', DBI_Biz_Track = '" + dbiBizTrack + "' where acadYear = '" + year + "' AND acadPeriod = '" + period + "' AND Course ='" + course + "' ";
August 6, 2012 at 10:44 am
Either that or you need to us the variable outside of the quotes if it holds a dynamic value.
Mark
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply