R
Roberto - Ingresso.com
Hey all,
I have a dll written in Vb.Net which has all my application's database
access. I used OdbcConnection in it for legacy compatibility. I want to use
the same dll to access Sql Server 7.0 and higher with SqlClient library when
the database allows its use. I am going to use OdbcConnection for Sql Server
6.5 access still.
What is the best way of using in the same code for two or more data access
libraries?
here is a simple code... Would I have to write one function for each data
access type?
Dim conSala As OdbcConnection
Dim adpSala As OdbcDataAdapter
conSala = New OdbcConnection
conSala.ConnectionString = "DSN=Multi;uid=sasa;pwd=sasa;"
adpSala = New OdbcDataAdapter("SELECT CDPARAM FROM PARAMS ORDER BY
CDPARAM", conSala)
dstSala = New DataSet
Try
adpSala.Fill(dstSala, "Params")
Catch ex As Exception
Return False
Finally
conSala.Close()
conSala = Nothing
adpSala = Nothing
End Try
Return True
I have a dll written in Vb.Net which has all my application's database
access. I used OdbcConnection in it for legacy compatibility. I want to use
the same dll to access Sql Server 7.0 and higher with SqlClient library when
the database allows its use. I am going to use OdbcConnection for Sql Server
6.5 access still.
What is the best way of using in the same code for two or more data access
libraries?
here is a simple code... Would I have to write one function for each data
access type?
Dim conSala As OdbcConnection
Dim adpSala As OdbcDataAdapter
conSala = New OdbcConnection
conSala.ConnectionString = "DSN=Multi;uid=sasa;pwd=sasa;"
adpSala = New OdbcDataAdapter("SELECT CDPARAM FROM PARAMS ORDER BY
CDPARAM", conSala)
dstSala = New DataSet
Try
adpSala.Fill(dstSala, "Params")
Catch ex As Exception
Return False
Finally
conSala.Close()
conSala = Nothing
adpSala = Nothing
End Try
Return True