473,412 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

IListSource does not contain any data

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 ***
Jan 31 '07 #1
0 874

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Eric J. Smith | last post by:
I am attempting to add an Editor attribute to an IListSource derived class (specifically it's a typed DataSet). It appears that IListSource over rules any Editor attribute. Is there any way that...
3
by: Abbiento Morgan | last post by:
Someone know where can i find information and/or example (better in c#) for IList/IListSource interfaces for connect a my class to the DataGrid component via SetDataBinding method ?
1
by: troutbum | last post by:
I am trying to bind a datagrid to a dataset that is returned via a function. Public Function RetrieveList(ByRef r_DataSet As DataSet) that sets the dataset that is passed by reference. When I try...
2
by: peter | last post by:
Hi, I try to bind a DataTable to a DataGrid, but I receive the following error-message : 'The IListSource does not contain any data sources'. I have no clue what the problem might be, as I...
8
by: Lars-Erik Aabech | last post by:
Hi! We've got an ASP.NET application that runs swell on development PC's and one live production server. Another prod. server though crashes a couple of times a week. Either something that...
10
by: Assimalyst | last post by:
Hi, I'm attempting to use a data reader to load data from a single table, tblCountry, with two columns, countryNo (the Key) and countryName, into a DropDownList box. Here's the code: ...
7
by: BS | last post by:
Hello everybody I'm calling a webservice that returns complex data. The goal is to populate a datagrid with it. Using a loop for each record found ( such as For i = 0 To...
0
by: Mike P | last post by:
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...
3
by: =?Utf-8?B?V2FsaWQ=?= | last post by:
Hello: I have migrated a site from IIS5 to IIS6. The site is configured and the we app is installed on the new IIS site. I can get to the web page but when I try to login, this is what I get...
2
by: =?Utf-8?B?UGFvbG8=?= | last post by:
I am trying to populate a Listbox with the results of a query triggered from a selection in a combo box: private void cmbxCategory_SelectedValueChanged(object sender, EventArgs e) { string...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.