用sqldataAdapter填充时数据集错误 [英] Error in Dataset while filling with sqldataAdapter
本文介绍了用sqldataAdapter填充时数据集错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友,
我收到以下错误:
Dear friends,
i am getting the following error:
Value cannot be null.
Parameter name: dataTable
在以下代码行上,
on following Code Line,
(adpTotalQuantity.Fill(dsTotalQuantity.Tables["Req_TotalInventoryRequired"]);
从这里进入异常....可能有问题吗?
我的代码如下
from here it goes into the Exceptions....wht could be issue with it?
my code is as below
SqlCommand cmdTotalQuantity = new SqlCommand("GetRequestedInventoryDetls", conTotalQuantity);
cmdTotalQuantity.CommandType = CommandType.StoredProcedure;
cmdTotalQuantity.Connection = conTotalQuantity;
cmdTotalQuantity.Parameters.Add("@RequestNo", SqlDbType.Int);
cmdTotalQuantity.Parameters["@RequestNo"].Value = Convert.ToInt32(RequestNo);
SqlDataAdapter adpTotalQuantity = new SqlDataAdapter(cmdTotalQuantity);
DataSet dsTotalQuantity = new DataSet();
adpTotalQuantity.Fill(dsTotalQuantity.Tables["Req_TotalInventoryRequired"]);
请回复,
aamir
pl reply,
aamir
推荐答案
使用以下行:
Use the following line :
adpTotalQuantity.Fill(dsTotalQuantity);
dsTotalQuantity.Tables ["Req_TotalInventoryRequired"]产生空值.尝试dsTotalQuantity.Tables [0]或任何索引.
dsTotalQuantity.Tables["Req_TotalInventoryRequired"] is producing a null value. Try dsTotalQuantity.Tables[0] or whatever the index is.
试试这个:
Hi,
Try this:
DataSet dsTotalQuantity = new DataSet();
DataTable dtReq=new DataTable();
adpTotalQuantity.Fill(dtReq);
dtReq.Name = "Req_TotalInventoryRequired";
dsTotalQuantity.Tables.Add(dtReq);
祝一切顺利.
--Amit
All the best.
--Amit
这篇关于用sqldataAdapter填充时数据集错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文