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
Norberto FlogarPosted Jul 3, 2012, 1:55 AM
Make sure that RequestNo value should be empty or null. error is because of that only
Thanks
Wall Stickers
Jignesh TrivediPosted Jul 2, 2012, 2:44 AM
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.
Blocked AccountPosted Jul 2, 2012, 2:04 AM
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
Aamir KhanPosted Jul 2, 2012, 12:51 AM
Blocked AccountPosted Jul 2, 2012, 12:27 AM
do like this
adpTotalQuantity.Fill(dsTotalQuantity, "Req_TotalInventoryRequired");
Thanks