IListSource is an interface that provides functionality to an object to return a list that can be bound to a datasource. A dataset for example implements this interface. Did you databind your datagrid to a dataset obtained form a query to a database using ADO.NET
? Can you provide a snippet of code showing your commands to hook up the datasource and databind?
Simon
This posting is provided "AS IS" with no warranties, and confers no rights.
I'm having this problem (The IListSource does not contain any data sources) and I don't know what could be wrong. If I test my SQL Query in SQL Analyzer, it does work fine. Now, when I run the query through my ASP.NET page, it sometimes work and others not,
even though is the same query. Dim connectionString As String = "Server='ServerName';User ID=username; Password=mypassword;database='databasename'" Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString) 'Set
max num of rows Dim strSQLMaxRecords as string If intMaxRecords > 0 Then strSQLMaxRecords = " TOP " & CStr(intMaxRecords) & " " Else strSQLMaxRecords = "" End If Dim queryString As String = _ "SELECT " & strSQLMaxRecords & _ " * " & _ " FROM dwidx.dbo.fsc_followup
as TFUP" & _ " ,dwidx.dbo.patient_fsc_list as TPFL " & _ " ,dwidx.dbo.patient as TPAT " & _ " WHERE " & _ " (TPFL.id = TFUP.id)" & _ " AND (TFUP.id = TPAT.id)" & _ " AND (TPFL.fsc = TFUP.fsc)" & _ " AND (TPAT.oth_num IS NOT NULL)" & _ " AND (TPAT.del_dt IS
NULL)" & _ " AND (TPAT.deact_dt IS NULL)" & _ " AND (TPAT.deceased_indicator IS NULL " & _ " OR TPAT.deceased_indicator = 'N') " ... ... queryString = queryString & " " & m_strSql Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString dbCommand.Connection = dbConnection 'Add Parameters Call AddSQLParameter("@FSCNUM",intFscn,dbCommand) 'End Add Parameters Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter dataAdapter.SelectCommand
= dbCommand Dim dataSet As System.Data.DataSet = New System.Data.DataSet Try lblQuery.Text = queryString dataAdapter.Fill(dataSet) 'Catch SQLex As System.Data.SqlClient.SqlException ' lblFeedback.Text = "SQL Error: " & SQLex.Message & SQLex.Number & "
" & queryString Catch ex as Exception lblFeedback.Text = "Fatal error: " & ex.Message End try return dataSet In the OnClick of my button... DataGrid1.DataSource = GetFSCRecords(intFSCN _ , txtINNM.Text _ , txtINA1.Text _ , txtINA2.Text _ , txtINCTY.Text _ ,
txtINST.Text _ , txtINZIP.Text _ , txtEFF_DT.Text _ , txtEXP_DT.Text _ , intMaxRecords) DataGrid1.DataBind() <<<< The error occurs here
timmed
Member
235 Points
47 Posts
The IListSource does not contain any data sources
Sep 10, 2002 02:35 PM|LINK
SimonCal
Participant
1910 Points
384 Posts
Microsoft
Re: The IListSource does not contain any data sources
Sep 10, 2002 05:03 PM|LINK
This posting is provided "AS IS" with no warranties, and confers no rights.
timmed
Member
235 Points
47 Posts
Re: The IListSource does not contain any data sources
Sep 10, 2002 06:32 PM|LINK
hherrera27
Member
5 Points
1 Post
Re: The IListSource does not contain any data sources
Feb 28, 2005 03:02 PM|LINK
" & queryString Catch ex as Exception lblFeedback.Text = "Fatal error: " & ex.Message End try return dataSet In the OnClick of my button... DataGrid1.DataSource = GetFSCRecords(intFSCN _ , txtINNM.Text _ , txtINA1.Text _ , txtINA2.Text _ , txtINCTY.Text _ , txtINST.Text _ , txtINZIP.Text _ , txtEFF_DT.Text _ , txtEXP_DT.Text _ , intMaxRecords) DataGrid1.DataBind() <<<< The error occurs here
codingvn
Member
283 Points
63 Posts
Re: The IListSource does not contain any data sources
Dec 13, 2007 03:04 AM|LINK
Hi !
You can check the dataSet.Tables.Cout > 0 Then return dataSet else return null;
I thinks the DataSet return have Count = 0 . [:)]