请哪位指点!!!
我在类中所建的函数:public DataSet updateset(DataSet changds,string mysqll)////更新数据库(数据集)
{
oladp = new OleDbDataAdapter(mysqll, con);
oldb = new OleDbCommandBuilder(oladp);
oladp.Fill(changds);
oladp.Update(changds);
return changds;
}
窗体应用:
private void button1_Click(object sender, EventArgs e)
{
databaseManager dm = new databaseManager();
string myScr = "select user_psw from usermanagertable where user_psw='" + textBox1.Text.Trim() + "'";
OleDbDataReader dr = dm.myreader(myScr);
if (textBox1.Text == "")
{
MessageBox.Show("请输入用户密码", "提示");
textBox1.Focus();
}
else if (textBox2.Text == ""&&textBox3.Text=="")
{
MessageBox.Show("请输入问题或答案", "提示");
textBox2.Text = textBox3.Text = "";
textBox2.Focus();
}
else
{
if (dr.HasRows)
{
while (dr.Read())
{
string mysrc = dr[0].ToString();
string updatestr ="update usermanagertable set user_question=" + textBox2.Text + ",user_answer=" + textBox3.Text + "";
DataSet ds = new DataSet();
dm.updateset(ds,updatestr);
dm.conclose();
}
}
else
{
MessageBox.Show("用户密码错误", "提示");
textBox1.Text = textBox2.Text = textBox3.Text="";
textBox1.Focus();
}
}
错误提示:
Update 无法找到 TableMapping['Table'] 或 DataTable“Table”。
请指正!!!
谢谢!