问题描述
this.conn7=newSystem.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;DataSource=C:\database1.accdb");this.conn7.Open();this.command7=newSystem.Data.OleDb.OleDbCommand("selectpasswordfromadminwherusername='"+this.textBox1.Text+"'",this.conn7);this.dataadapter7=newSystem.Data.OleDb.OleDbDataAdapter();this.dataadapter7.SelectCommand=this.command7;this.dataset=newDataSet();this.dataadapter7.Fill(this.dataset,"stu");if(this.textBox1.Text==""||this.textBox2.Text==""||this.textBox3.Text==""){MessageBox.Show("不能为空");return;}DataRowdatarow=this.dataset.Tables[0].NewRow();//新建一行datarow[0]=this.textBox2.Text;this.dataset.Tables[0].Rows.Add(datarow);//添加到数据集的表中OleDbCommandBuildercb=newOleDbCommandBuilder(this.dataadapter7);try{this.dataadapter7.Update(this.dataset,"stu");}catch(Exceptionee){MessageBox.Show(ee.Message);}finally{MessageBox.Show("修改成功!");}
解决方案
解决方案二:
你就不能告诉我哪里错了?
解决方案三:
this.dataadapter7.Fill(this.dataset,"stu");说这句格式错误!@不应该啊
解决方案四:
要不帮我重新写写代码?
解决方案五:
this.dataadapter7.Fill(this.dataset,"stu");把this.dataset的this去掉.在试试.你的程序有顺序都不对啊,要先判断控件,然后在修改数据..finally{MessageBox.Show("修改成功!");}你的成功提示信息在finally里面?
解决方案六:
具体是什么错误?
解决方案七:
还是不对@还是老地方出错舞
解决方案八:
OleDbConnectioncon=newOleDbConnection("provider=microsoft.jet.OLEDB.4.0;Datasource=.\odc.db");con.Open();OleDbDataAdaptercom=newOleDbDataAdapter("UpdateadminSET密码='"+textBox4.Text.Trim()+"'where用户名='"+textBox1.Text.Trim()+"'and密码='"+textBox2.Text.Trim()+"'",con);DataSetdi=newDataSet();com.Fill(di,"dataname");MessageBox.Show("修改密码成功.","修改密码");
解决方案九:
愿意帮我的家QQ啊感激不尽啊!~549905721