late binding or vb.net CF multiple datasource types for data connection
Posted on 2006-07-10
This question is for vb.net CF not full vb.net.
Does vb.net 2005 support late binding?
I am currently using vb.net 2003 and it doesn't.
My problem is that I have an app that can utilize several different database types (Access, Sql, Oracle etc).
I wanted to know how I can set up my variables one time instead of twice as below because doing it as I have
below, forces me to have multiple lines of repetitive code (1 for each type of connection)
Public Shared cnS As New SqlServerCe.SqlCeConnection("Data Source=SDMMC Disk\isis.SDF")
Public Shared cnCmdS As New SqlServerCe.SqlCeCommand
Public Shared drDBS As SqlServerCe.SqlCeDataReader
Public Shared custDAS As SqlServerCe.SqlCeDataAdapter = New SqlServerCe.SqlCeDataAdapter
Public Shared cnA As AdoceConnection
Public Shared cnCmdA As New InTheHand.Data.Adoce.AdoceCommand
Public Shared drDBA As InTheHand.Data.Adoce.AdoceDataReader
Public Shared cnA2 As AdoceConnection
Here is a sample of code. I would like to make this more efficient
If SPLASH.MDATABASE = "ACCESS" Then
SPLASH.cnCmdA.CommandText = "Insert into tbl...................."
SPLASH.cnCmdA.Connection = SPLASH.cnA
SPLASH.cnCmdS.CommandText = "Insert into tbl..................."
SPLASH.cnCmdS.Connection = SPLASH.cnS