本文介绍了更新无法使用dataadapter找到TableMaping的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在Web项目中工作,我正在使用Dataadapter.update(dataset)方法进行批处理插入,但是我收到更新无法找到TableMapping [''Table'']或DataTable"Table"错误,我在其中搜索了google,但未找到任何解决方案,


我用来插入数据的代码是:

数据集DS = new数据集();

IDbDataAdapter Da = ClsDataFactory.CreateAdapter(cmd,dbtype);

cmd.commandtext ="storedprocedureName";
Da.InsertCommand =(SqlCommand)cmd;
Da.InsertCommand.Connection =(SqlConnection)con;

RecordAffected = Da.Update(DS);



请帮我.非常紧急!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

感谢Adavance,

Sudhir

Hi All,

I am working in web project , I am using Dataadapter.update(dataset) method for batch insert but i am getting "Update unable to find TableMapping[''Table''] or DataTable ''Table'' " error, I searched on google but did not find any solution,


Code i am using to insert the data is:

dataset DS=new dataset();

IDbDataAdapter Da = ClsDataFactory.CreateAdapter(cmd, dbtype);

cmd.commandtext="storedprocedureName";
Da.InsertCommand = (SqlCommand)cmd;
Da.InsertCommand.Connection = (SqlConnection)con;

RecordAffected = Da.Update(DS);



Please help me. its very urgent!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thanks in Adavance,

Sudhir

推荐答案

An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll

Additional information: Update unable to find TableMapping['Table'] or DataTable 'Table'.

To resolve this problem, make sure that the DataTable that you want to update is not Nothing or Null before you pass it into the Update method of the DataAdapter.



看起来您正在尝试将更新传递给刚创建的空数据集.
您需要使用以下信息填充数据集:



像这样的东西:
Da.Fill(DS);



It looks like you''re trying to pass an Update to an empty Dataset you''ve just created.
You need to fill the dataset with information:

http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/3adacd01-f08f-4059-bbce-bff736a5188e/

Something like:
Da.Fill(DS);



这篇关于更新无法使用dataadapter找到TableMaping的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 19:53