J
J L
I am still struggling to understand the usage of Interfaces in an
attempt to make a provider independent data access layer. My question
is this...if I create a connection from an interface that is specfic
to a data prvoider, will the remaining objects created from interfaces
and based on the connection object automatically be of the same
provider type?
For example, does this work....
(Note: strConnect and strSql set elsewhere based on the
desired dbType and action)
Dim conn As IDbConnection
Dim cmd As IDbCommand
Dim da as IDbDataAdapter
dim ds as DataSet
Select Case dbType
Case "SQL"
conn = New SQLCommand(strConnect)
Case "OleDB"
conn = New OleDBCommand(strconnect)
End Select
cmd = New IDbCommand(strSql, conn)
da = New IDbDataAdapter(cmd)
da.Fill(ds, "SomeTable")
TIA,
John
attempt to make a provider independent data access layer. My question
is this...if I create a connection from an interface that is specfic
to a data prvoider, will the remaining objects created from interfaces
and based on the connection object automatically be of the same
provider type?
For example, does this work....
(Note: strConnect and strSql set elsewhere based on the
desired dbType and action)
Dim conn As IDbConnection
Dim cmd As IDbCommand
Dim da as IDbDataAdapter
dim ds as DataSet
Select Case dbType
Case "SQL"
conn = New SQLCommand(strConnect)
Case "OleDB"
conn = New OleDBCommand(strconnect)
End Select
cmd = New IDbCommand(strSql, conn)
da = New IDbDataAdapter(cmd)
da.Fill(ds, "SomeTable")
TIA,
John