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"]);
pl reply,
aamir
Loading

Blocked AccountRank #403 · 6.2K reputationPosted Jul 1, 2012, 8:27 PM EDT
do like this
adpTotalQuantity.Fill(dsTotalQuantity, "Req_TotalInventoryRequired");
Thanks
Aamir KhanRank #7,345 · 243 reputationPosted Jul 1, 2012, 8:51 PM EDT
Blocked AccountRank #403 · 6.2K reputationPosted Jul 1, 2012, 10:04 PM EDT
Take the reference of this article, there are lots of overload of fill method.
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.fill.aspx
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 1, 2012, 10:44 PM EDT
I think, This error due to Req_TotalInventoryRequired is not present in your dataset.
so try...
DataSet dsTotalQuantity = new DataSet();
DataTable dt = new DataTable();
dt.TableName = "Req_TotalInventoryRequired";
adpTotalQuantity.Fill(dt);
dsTotalQuantity.Tables.Add(dt);
hope this will help you.
Norberto Flogar16 reputationPosted Jul 2, 2012, 9:55 PM EDT
Make sure that RequestNo value should be empty or null. error is because of that only
Thanks
Wall Stickers