Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > IListSource does not contain any data

Reply
Thread Tools

IListSource does not contain any data

 
 
Mike P
Guest
Posts: n/a
 
      01-31-2007
I am getting the error The 'IListSource does not contain any data
sources' on the DataBind line in my code below. I have stepped through
and there are records in the data reader...in fact this code has been
working for over a year and has just now starting to give this error.
Can anybody help?

private void BindData()
{
string strLeadAssignmentCount = "";

SqlConnection objConnection = new
SqlConnection(ConfigurationSettings.AppSettings["constr"]);
objConnection.Open();

//get row count
switch (intJobRoleKey)
{
//admin
case 2:
strLeadAssignmentCount = "select count(*) ";
strLeadAssignmentCount += "from atradius_staging
where assigned = 0";
break;

//CI
case 5:
strLeadAssignmentCount = "select count(*) ";
strLeadAssignmentCount += "from atradius_staging
where assigned = 0 and leadtypekey = 1";
break;

//DC
case 6:
strLeadAssignmentCount = "select count(*) ";
strLeadAssignmentCount += "from atradius_staging
where assigned = 0 and leadtypekey = 2";
break;

//Brokers
case 7:
strLeadAssignmentCount = "select count(*) ";
strLeadAssignmentCount += "from atradius_staging
where assigned = 0 and leadtypekey = 3";
break;

default:
Response.Redirect("default.aspx");
break;
}

SqlCommand objCommandCount = new
SqlCommand(strLeadAssignmentCount, objConnection);
int intTotalRows =
Convert.ToInt32(objCommandCount.ExecuteScalar());

if (intTotalRows > 0)
{
//now populate datareader with actual data
SqlCommand objCommand = new
SqlCommand("LeadAssignmentList", objConnection);
objCommand.CommandType = CommandType.StoredProcedure;

SqlParameter prmJobRoleKey = new
SqlParameter("@JobRoleKey", SqlDbType.Int, 4);
prmJobRoleKey.Value = intJobRoleKey;
objCommand.Parameters.Add(prmJobRoleKey);

// try
// {
SqlDataReader result =
objCommand.ExecuteReader(CommandBehavior.CloseConn ection);

//populate datagrid
dgLeadAssignment.DataSource = result;
dgLeadAssignment.DataBind();

GetUserList();
imgKey.Visible = true;
btnAssignLeads.Visible = true;
dgLeadAssignment.Visible = true;
// }
// catch
// {
// }
}
else
{
imgKey.Visible = false;
btnAssignLeads.Visible = false;
dgLeadAssignment.Visible = false;
lblTotalUnassigned.Text = "Total unassigned leads : " +
intTotalRows.ToString();
}


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The IListSource does not contain any data sources. =?Utf-8?B?V2FsaWQ=?= ASP .Net 10 09-14-2007 10:25 PM
DataBind to DropDownList Problem "The IListSource does not contain any data sources" Assimalyst ASP .Net 10 07-08-2005 03:09 PM
The IListSource does not contain any data sources. <-- ? KK ASP .Net Datagrid Control 1 01-13-2005 12:13 PM
'IListSource does not contain any data sources' peter@yahoo.not ASP .Net 2 01-13-2005 08:23 AM
IListSource does not contain any data sources. troutbum ASP .Net 1 10-06-2004 04:43 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57