我现在根据一个id已经将所有的字段显示出来
因为我要完成对数据库的修改功能,所以我显示的时候不是用的label
而是用的textbox,显示的内容理论上应该是可以修改的,
我有一个button,写cs文件的时候却没有update?很奇怪,只有叫updatepanel那updatepanel怎么用呢

解决方案 »

  1.   

    updatepanel里面放textbox,多么简单的问题。
      

  2.   

    update这个是要自己写更新SQL语句的~!没有控件帮你更新数据库的~~!!!!!
      

  3.   


            string h = TextBox8.Text;
            string i = TextBox9.Text;        string y = TextBox10.Text;        string m = TextBox11.Text;        string n = TextBox12.Text;        string o = TextBox13.Text;        string p = TextBox14.Text;
            string q = TextBox15.Text;        string r = TextBox16.Text;
            string t = TextBox17.Text;        OleDbConnection conn = new OleDbConnection();
            conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|db1.mdb";
            OleDbCommand comm = new OleDbCommand();
            conn.Open();
            comm.Connection = conn;        comm.CommandText = "update userdetail 就没有update这个语句
      

  4.   

     comm.CommandText = "update userdetail 就没有update这个语句.........
    sql语句这是自己写的吧?你没写怎么会有?比如以下
    comm.CommandText = "update T_User set T_UserName='" + T_UserName + "',T_Title1='" + T_Title1 + "'";
    update 表名称 set 要更新的字段
      

  5.   


            string m = TextBox11.Text;        string n = TextBox12.Text;        string o = TextBox13.Text;        string p = TextBox14.Text;
            string q = TextBox15.Text;        string r = TextBox16.Text;
            string t = TextBox17.Text;        OleDbConnection conn = new OleDbConnection();
            conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|db1.mdb";
            OleDbCommand comm = new OleDbCommand();
            conn.Open();
            comm.Connection = conn;        comm.CommandText ="update userdetail set username='a',sex='b',age='c',nativeplace='d',tel='s',email='k',xueli='g',school='f',position='i',english='y',jybj='m',gzjl='n',zytc='o',zycg='p',jtqk='q',xqah='r',qzyx='t' where tel ='x'";        comm.Parameters.AddWithValue("@username", a);
            comm.Parameters.AddWithValue("@sex", b);
            comm.Parameters.AddWithValue("@age", c);
            comm.Parameters.AddWithValue("@nativeplace", d);
            comm.Parameters.AddWithValue("@tel", s);
            comm.Parameters.AddWithValue("@email", k);
            comm.Parameters.AddWithValue("@xueli", g);
            comm.Parameters.AddWithValue("@school", f);
            comm.Parameters.AddWithValue("@position", i);
            comm.Parameters.AddWithValue("@english", y);
            comm.Parameters.AddWithValue("@jybj", m);        comm.Parameters.AddWithValue("@gzjl", n);
            comm.Parameters.AddWithValue("@zytc", o);
            comm.Parameters.AddWithValue("@zycg", p);
            comm.Parameters.AddWithValue("@jtqk", q);
            comm.Parameters.AddWithValue("@xqah", r);
            comm.Parameters.AddWithValue("@qzyx", t);
                        conn.Close();我写好了,部分代码是这样的,有错误吗?没有效果,是为什么啊
      

  6.   

    要自己在Button的Click事件里用sql语句编写更新的方法的。
      

  7.   

        string p = TextBox14.Text;
            string q = TextBox15.Text;        string r = TextBox16.Text;
            string t = TextBox17.Text;        OleDbConnection conn = new OleDbConnection();
            conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|db1.mdb";
            OleDbCommand comm = new OleDbCommand();
            conn.Open();
            comm.Connection = conn;        comm.CommandText = "UPDATE [userdetail] SET [username]='" + z + "',[sex]='" + b + "',[age]='" + c + "',[nativeplace]='" + d + "',[tel]='" + s + "',[email]='" + k + "',[xueli]='" + g + "',[school]='" + f + "',[position]='" + i + "',[english]='" + y + "',[jybj]='" + m + "',[gzjl]='" + n + "',[zytc]='" + o + "',[zycg]='" + p + "',[jtqk]='" + q + "',[xqah]='" + r + "',[qzyx]='" + t + "' WHERE [tel] ='" + x + "'";        comm.Parameters.AddWithValue("@username", z);
            comm.Parameters.AddWithValue("@sex", b);
            comm.Parameters.AddWithValue("@age", c);
            comm.Parameters.AddWithValue("@nativeplace", d);
            comm.Parameters.AddWithValue("@tel", s);
            comm.Parameters.AddWithValue("@email", k);
            comm.Parameters.AddWithValue("@xueli", g);
            comm.Parameters.AddWithValue("@school", f);
            comm.Parameters.AddWithValue("@position", i);
            comm.Parameters.AddWithValue("@english", y);
            comm.Parameters.AddWithValue("@jybj", m);        comm.Parameters.AddWithValue("@gzjl", n);
            comm.Parameters.AddWithValue("@zytc", o);
            comm.Parameters.AddWithValue("@zycg", p);
            comm.Parameters.AddWithValue("@jtqk", q);
            comm.Parameters.AddWithValue("@xqah", r);
            comm.Parameters.AddWithValue("@qzyx", t);        comm.ExecuteNonQuery();
            conn.Close();我改成这样了,但是还是没有效果,请高手帮我解决下!