本文介绍了无法找到TableMapping ["cars"]或DataTable"cars".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我有一个问题,几个小时后,我试图找出我做错了什么.
因此,我想从表中删除一条记录(我使用acces).我创建了一个组合框,在其中放置了所有id的汽车.但是我收到此错误:无法找到TableMapping ["cars"]或DataTable"cars""
波纹管是代码,请提供解决方案.



private void button1_Click(对象发送者,EventArgs e)
{
字符串str = comboBox1.Text;
OleDbConnection myConex =新的OleDbConnection(sirConex);

字符串deletecar =从id_car = @ str的汽车中删除";
OleDbCommand cmd =新的OleDbCommand(deletecar,myConex);

cmd.Parameters.Add("@ str",OleDbType.Char).Value = str;


mda.InsertCommand = cmd;


试试
{
mda.Update(mds,"cars");


}

捕获(异常摘录)
{
MessageBox.Show("Error:" + excpt.Message);

}
}

Hello everyone!

I have a problem, and for several a hours i try to found what i''m doing wrong.
So, i want to delete a record from a table(i use acces). I create a combobox where i put all id''s cars. But i receive this error : "Unable to find TableMapping["cars"] or DataTable "cars""
Bellow is the code, please help with a solution.



private void button1_Click(object sender, EventArgs e)
{
string str = comboBox1.Text;
OleDbConnection myConex = new OleDbConnection(sirConex);

string deletecar = "Delete from cars where id_car=@str";
OleDbCommand cmd = new OleDbCommand(deletecar, myConex);

cmd.Parameters.Add("@str", OleDbType.Char).Value = str;


mda.InsertCommand = cmd;


try
{
mda.Update(mds,"cars");


}

catch (Exception excpt)
{
MessageBox.Show("Error:" + excpt.Message);

}
}

推荐答案




这篇关于无法找到TableMapping ["cars"]或DataTable"cars".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 20:21