|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, August 06, 2012 11:38 PM
Points: 1,
Visits: 29
|
|
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.
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 4:39 PM
Points: 325,
Visits: 123
|
|
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 + "' ";
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Saturday, March 30, 2013 12:00 PM
Points: 82,
Visits: 348
|
|
Either that or you need to us the variable outside of the quotes if it holds a dynamic value.
Mark
|
|
|
|