用OleDb和数据库连接,然后把操作传回数据库,Page_Load正确,Button2_Click有错误,请帮忙看一下问题出在哪里,先谢过了~~
private string id = "2";
protected void Page_Load(object sender, EventArgs e)
{
OleDbConnection s = new OleDbConnection("provider=vfpoledb.1;Data Source=D:/Vfp98/我的东西/asp2.dbc;collating sequence=machine;");
OleDbCommand cmd = new OleDbCommand("select item from 表1 where id="+this.id, s);
cmd.Connection.Open();
string i = Convert.ToString(cmd.ExecuteScalar());
this.Label1.Text = i;
OleDbCommand cmd1 = new OleDbCommand("select xyid,nr from 表2 where id=" + this.id, s);
OleDbDataReader a = cmd1.ExecuteReader();
this.RadioButtonList1.DataTextField = "nr";
this.RadioButtonList1.DataValueField = "xyid";
this.RadioButtonList1.DataSource = a;
this.RadioButtonList1.DataBind();
a.Close();
s.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
OleDbConnection m= new OleDbConnection("provider=vfpoledb.1;Data Source=D:/Vfp98/我的东西/asp2.dbc;collating sequence=machine;");
OleDbCommand n = new OleDbCommand();
n.Connection = m;
n.Connection.Open();
n.CommandText = "update 表2 set xx=xx+1 where id="+id+"and xyid=" +this.RadioButtonList1.SelectedValue.ToString();
n.ExecuteNonQuery();
m.Close();
运行后用户代码未处理框提示"Missing operand."出错的位置是 n.ExecuteNonQuery();请教~~