F
fniles
When using VB6 and ADO, if I only do a Read, I will open a recordset with
Forward Only cursor and Read Only lock, thus it will be faster than a non
Read recordset.
In VB.NET, when only need to do a Read, is it correct that I want to use
OLEDBDataReader (SQLDataReader for SQL Server), when when doing a Read/Write
I use OLEDBDataAdapter (SQLDataAdapter for SQL Server) like in the following
codes ?
Is using OLEDBDataReader/SQLDataReader faster than using
OLEDBDATAAdapter/SQLDataAdapter ?
Thank you
'READ ONLY
Dim dr As OleDb.OleDbDataReader
Dim cmd As New OleDb.OleDbCommand
With cmd
.Connection = g_ConnectionDemoOLE
.CommandText = sql
dr = .ExecuteReader()
:
'READ/WRITE
Private m_da As New OleDb.OleDbDataAdapter
Private m_cmd As New OleDb.OleDbCommand
Dim m_ds As New DataSet
With m_cmd
.Connection = adoConOLE
.CommandText = sSQL
End With
m_da.SelectCommand = m_cmd
m_da.Fill(m_ds)
Forward Only cursor and Read Only lock, thus it will be faster than a non
Read recordset.
In VB.NET, when only need to do a Read, is it correct that I want to use
OLEDBDataReader (SQLDataReader for SQL Server), when when doing a Read/Write
I use OLEDBDataAdapter (SQLDataAdapter for SQL Server) like in the following
codes ?
Is using OLEDBDataReader/SQLDataReader faster than using
OLEDBDATAAdapter/SQLDataAdapter ?
Thank you
'READ ONLY
Dim dr As OleDb.OleDbDataReader
Dim cmd As New OleDb.OleDbCommand
With cmd
.Connection = g_ConnectionDemoOLE
.CommandText = sql
dr = .ExecuteReader()
:
'READ/WRITE
Private m_da As New OleDb.OleDbDataAdapter
Private m_cmd As New OleDb.OleDbCommand
Dim m_ds As New DataSet
With m_cmd
.Connection = adoConOLE
.CommandText = sSQL
End With
m_da.SelectCommand = m_cmd
m_da.Fill(m_ds)