Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public List<checklist> GetCheckListDetails(int BusinessTypeId, int FilingTypeId)
{
List<checklist> list = new List<checklist>();
try
{
using (var dao = DbActivity.Open())
{

CSqlDbCommand cmd = new CSqlDbCommand(DBProcedures.WorkOrderSearch.USP_INSERT_BUSINESSFILLING_DETAILS);

cmd.Parameters.AddWithValue("BusinessTypeId", BusinessTypeId);
cmd.Parameters.AddWithValue("FilingTypeId", FilingTypeId);
SqlDataAdapter da = new SqlDataAdapter();

DataSet ds = new DataSet();
da.Fill(ds);
list = (from c in ds.Tables[0].AsEnumerable()
select new CheckList()
{
CheckListId = c[0].ToInt(),
Deatil = c[1].ToStr(),

}).ToList();
}

}

catch (Exception ex)
{
Logger.Database.Error(ex.Message, ex);
throw;
}

return list;

}

this is my method to be executed and it is throwing an error called the selectcommand property has not been initialized before calling fill? how to fix it?

thanks in advance
Posted

1 solution

Hi
add this before da.fill

da.selectcommand=cmd;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900