473,325 Members | 2,442 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,325 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 1378

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...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.