我目前面临一个奇怪的问题,每次我想将我的表值字段从保留更新为已取消。
每当我点击按钮时它就会弹出任何错误但是当我去我的ms-access检查时它永远不会改变......
我的方法:
public static void CancelClasses(int rid, int mid)
{
OleDbConnection myconnection = GetConnection();
string mysql = "UPDATE ClassesReservation SET Status = 'cancelled' WHERE ReservationID= "+rid+" AND MID="+mid+";";
OleDbCommand mycmd = new OleDbCommand(mysql, myconnection);
try
{
myconnection.Open();
mycmd.ExecuteNonQuery();
}
catch
{
throw;
}
finally
{
myconnection.Close();
}
}
按钮功能:
protected void CancelWS_Click(object sender, EventArgs e)
{
if (ListBox3.SelectedIndex < 0)
{
Label2.Text = "Invalid Submit! Please select an Class or Workshop";
}
else
{
int reid = int.Parse(ListBox3.SelectedValue);
int MID = Convert.ToInt32(Session["memberid"]);
DBconn.CancelClasses(reid, MID);
}
}