CreateDataReader_OleDb – Create an OLEDB Data Reader

CreateDataReader_OleDb – Create an OLEDB Data Reader

' return a DataReader over an OleDbConnection'' CONNSTRING is the connection string' SQL is the SQL Select statement to be executed'' the connection will be automatically closed when the DataReader is disposed' any exception is returned to the callerFunction CreateDataReader_OleDb(ByVal connString As String, _    ByVal sql As String) As System.Data.OleDb.OleDbDataReader    ' open the connection    Dim cn As New System.Data.OleDb.OleDbConnection(connString)    cn.Open()    ' prepare the SQL SELECT command    Dim cmd As New System.Data.OleDb.OleDbCommand(sql, cn)    ' create a DataReader - note the CloseConnection argument    ' which causes the Connection to be closed when the DataReader is disposed    Dim dr As System.Data.OleDb.OleDbDataReader = cmd.ExecuteReader _        (CommandBehavior.CloseConnection)    ' dispose the Command object and return the result    cmd.Dispose()    Return drEnd Function

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several