日期:2014-05-17  浏览次数:20523 次

至少一个参数没有被指定值
    protected void Button1_Click(object sender, EventArgs e)
    {
        OleDbConnection conn;
        OleDbCommand cmd;
        string olecmd, oleString;
        oleString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("App_Data/Database.mdb");
        olecmd = "insert into choose([user],name,class) select [user],name,class from userload where [user]='";
        olecmd += Session["user"].ToString() + "'";
        conn = new OleDbConnection();
        conn.ConnectionString = oleString;
        cmd = new OleDbCommand();
        cmd.Connection = conn;
        cmd.CommandText = olecmd;
        conn.Open();
        cmd.ExecuteNonQuery();
        conn.Close();
        foreach (GridViewRow row in this.GridView1.Rows)
        {
            Control ctrl = row.FindControl("CheckBox");
            if ((ctrl as CheckBox).Checked)
            {

                olecmd = "UPDATE choose SET xmid=";
                olecmd += row.Cells[1].Text.Trim();
                olecmd += ",xmmc=";
                olecmd += row.Cells[2].Text.Trim();
                olecmd += " WHERE [user]='";
                olecmd += Session["user"].ToString() + "'";
                conn = new OleDbConnection();
                conn.ConnectionString = oleString;
                cmd = new OleDbCommand();
                cmd.Connection = conn;
                cmd.CommandText = olecmd;
                conn.Open();
                cmd.ExecuteNonQuery();
  &nb