Aamir Khan

Aamir Khan

  • NA
  • 277
  • 438.7k

Error in Dataset while filling with sqldataAdapter

Jul 2 2012 12:18 AM
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

Answers (5)