I have a asp.net project that I am developing in Visual Studio .NET. I want to connect to the database, but I do not want to have to create a db connection on every page, everytime I want to get a recordset. I would like to create a function that can be accessed from any page within the project and will return the recordset from the DB. Also, I would not like to do this in a include file. Any help would be greatly appreciated. I wrote this db connection function to do the job, just don't know what do with it so that I can access it from all pages...
Public Shared Function getDataReader(ByVal sqlqry As String) As OleDbDataReader
Dim Connstring As String = "blah"
Dim conn As New OleDbConnection(Connstring)
Dim objcmd As New OleDbCommand(sqlqry, conn)
Dim dtr As OleDbDataReader
.CommandType = CommandType.Text
dtr = objcmd.ExecuteReader()
Catch ex As Exception
'exception handling code to go here
dtr = Nothing
objcmd = Nothing