Reputation: 134
This application I'm building imports data into a database and runs some magic on it. I then want to display the results of a separate query on my page. It's kinda sorta not really working now.
The app call:
Dim leftovers As IDataReader
leftovers = GetImportDetails()
Response.Write("<B>Records that were not updated:</B><BR>")
Response.Write(leftovers)
Response.Write("<BR><B>Processing Complete.</B><BR><BR>")
And the function:
Function GetImportDetails() As IDataReader
Dim strSQL As String, DAL As New DAL.DataAccess
Dim dr As IDataReader
'Get a list of records that weren't updated
strSQL = "SELECT SalesRep, IDNumber, Name, EffDate, Product, CancDate, Reason " & _
" FROM tblCommCancel"
dr = DAL.ExecDataReader(strSQL, CommandType.Text)
GetImportDetails = dr
dr = Nothing
DAL = Nothing
End Function
Right now, my output looks as follows:
Records that were not updated:
System.Data.SqlClient.SqlDataReader
Processing Complete.
What am I missing here?
Upvotes: 0
Views: 440
Reputation: 32699
Response.Write
knows how to handle strings, but you passed it an IDataReader
. So it called the .ToString()
function of the leftovers
to get it into a string which is why you see "System.Data.SqlClient.SqlDataReader" as the output. You should either build some HTML in your code behind and write that to the response (or add it to a placeholder), or use a control you can bind data to such as GridView.
Upvotes: 2