How to "Set" a function equal to a DataReader
I'm trying to do this...
'<--------------------Start Code---------------------->'
Function GetReader() as SqlDataReader
Dim strConn as String = ConfigurationSettings.AppSettings("strConn")
Dim conn As New SqlConnection (strCONN)
Dim strSQL = "Select * from Table1"
Dim oCmd as New SqlCommand (strSQL)
oCmd.Connection = conn
conn.Open
Dim oRead As SqlDataReader = oCmd.ExecuteReader ()
Set GetReader = oRead 'This line doesn't work
conn.Close
End Function
'<---------------------End Code----------------------->'
What I want to do is set up a function that executes a stored procedure and returns the reader. When I try to run this I get a message saying "Set" isn't supported anymore. I'm cool with that. Now I'm just wondering how to duplicate that functionality, or something similar, in .Net.
Thanks,
Jerry
|