sanctified
Programmer
Hi Group,
An existing application exists which has been developed around the OO model. Lots of classes with standard routines etc.
I need to add an extra page which gets its data from the database and places this in a datagrid.
I've created an aspx page which holds the datagrid.
My code is as follows (snippet):
dsetIncomplete = New DataSet
eDMSDataHandler.PopulateIncompleteList(dsetIncomplete)
dagIncomplete.DataSource = dsetIncomplete
dagIncomplete.DataBind()
The method PopulateIncompleteList is in a class. Here it is in its entirety:
Public Shared Sub PopulateIncompleteList(ByVal dsetincomplete As DataSet)
Dim drIncomplete As SqlDataReader
Dim cmd As New SqlCommand
Dim cnn As New SqlConnection
cnn.ConnectionString = GetConnectionString() (method held in another class)
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "eDMS_ListAllIncompleteRecords"
cmd.Connection = cnn
cnn.Open()
drIncomplete = cmd.ExecuteReader
cnn.Close()
cnn.Dispose()
cmd.Dispose()
End Sub
However once this method is executed and my calling page is called, this line dagIncomplete.DataBind() gives an error:
The IListSource does not contain any data sources.
How can I get over this?
I've used similar syntax i.e. calling the class for drop down lists and this works, but I can't seem to get it to work for the grid.
Many thanks
An existing application exists which has been developed around the OO model. Lots of classes with standard routines etc.
I need to add an extra page which gets its data from the database and places this in a datagrid.
I've created an aspx page which holds the datagrid.
My code is as follows (snippet):
dsetIncomplete = New DataSet
eDMSDataHandler.PopulateIncompleteList(dsetIncomplete)
dagIncomplete.DataSource = dsetIncomplete
dagIncomplete.DataBind()
The method PopulateIncompleteList is in a class. Here it is in its entirety:
Public Shared Sub PopulateIncompleteList(ByVal dsetincomplete As DataSet)
Dim drIncomplete As SqlDataReader
Dim cmd As New SqlCommand
Dim cnn As New SqlConnection
cnn.ConnectionString = GetConnectionString() (method held in another class)
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "eDMS_ListAllIncompleteRecords"
cmd.Connection = cnn
cnn.Open()
drIncomplete = cmd.ExecuteReader
cnn.Close()
cnn.Dispose()
cmd.Dispose()
End Sub
However once this method is executed and my calling page is called, this line dagIncomplete.DataBind() gives an error:
The IListSource does not contain any data sources.
How can I get over this?
I've used similar syntax i.e. calling the class for drop down lists and this works, but I can't seem to get it to work for the grid.
Many thanks