protected void Button1_Click(object sender, EventArgs e)
{
OleDbConnection connstr = DBConnections.DBConnections.createConnection();
connstr.Open();
string bigclassname = Convert.ToString(this.TextBox1.Text);
string bigid = Convert.ToString(this.TextBox2.Text);
string sql = "update Hover_BigClass_New set BigClassName='" + bigclassname + "',BigID='" + bigid + "'where BigClassID =" + Request["bigclassid"];
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = connstr;
cmd.CommandText = sql; cmd.ExecuteNonQuery();
Response.Write("<script language='javascript'>alert('提交成功!');window.location.href='classmanage.aspx';</script>");
connstr.Close();
}
其中Request["bigclassid"]为数字,没有提示错误,数据也没有变化,就是没反应。。高手指点。
{
OleDbConnection connstr = DBConnections.DBConnections.createConnection();
connstr.Open();
string bigclassname = Convert.ToString(this.TextBox1.Text);
string bigid = Convert.ToString(this.TextBox2.Text);
string sql = "update Hover_BigClass_New set BigClassName='" + bigclassname + "',BigID='" + bigid + "'where BigClassID =" + Request["bigclassid"];
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = connstr;
cmd.CommandText = sql; cmd.ExecuteNonQuery();
Response.Write("<script language='javascript'>alert('提交成功!');window.location.href='classmanage.aspx';</script>");
connstr.Close();
}
其中Request["bigclassid"]为数字,没有提示错误,数据也没有变化,就是没反应。。高手指点。
比字符串+++的 容易看~我现在就最看不了字符串++的
Response.Write(sql);
看看你要执行的sql语句是什么,再贴出来给大家看看
这句应该是过了。
可是你刚才说没有反应。不知道是怎么回事。。
有变化没有?
string bigclassname = Convert.ToString(this.TextBox1.Text);
string bigid = Convert.ToString(this.TextBox2.Text);
这两句不能正确接收数据。
public partial class admins_editClass : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
OleDbConnection connstr = DBConnections.DBConnections.createConnection();
connstr.Open(); string sql1 = "select * from Hover_BigClass_New where BigClassID="+ Request["bigclassid"];
OleDbCommand cmds = new OleDbCommand(sql1,connstr);
OleDbDataReader dr=cmds.ExecuteReader();
if(dr.Read())
{
this.TextBox1.Text = dr["BigClassName"].ToString();
this.TextBox2.Text = dr["BigID"].ToString();
} dr.Dispose();
dr = null;
connstr.Close(); }
}
protected void Button1_Click(object sender, EventArgs e)
{
OleDbConnection connstr = DBConnections.DBConnections.createConnection();
connstr.Open();
string bigclassname = Convert.ToString(this.TextBox1.Text);
string bigid = Convert.ToString(this.TextBox2.Text);
string sql = "update Hover_BigClass_New set BigClassName='" + bigclassname + "',BigID='" + bigid + "' where BigClassID =" + Convert.ToInt32(Request["bigclassid"]);
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = connstr;
cmd.CommandText = sql;
//Response.Write(sql);
cmd.ExecuteNonQuery();
Response.Write("<script language='javascript'>alert('提交成功!');window.location.href='classmanage.aspx';</script>");
connstr.Close();
}
}