I want to give my windowsapplication a param to say how the programm connects, uses datareaders, command-objects etc. by OleDB or by SQL (the database may be Access or MS-SQL-Server). The syntax I use for this objects seems to be the same, but the objects itselve are different.
Dim oCON As OleDbConnection
Dim oCMD As OleDbCommand
Dim oCMD1 As OleDbCommand
Dim oDR As OleDbDataReader
Dim oDR1 As OleDbDataReader
Dim oCON_sql As SqlConnection As SqlConnection
Dim oCMD_sql As SqlCommand
Dim oCMD1_sql As SqlCommand
Dim oDR_sql As SqlDataReader
Dim oDR1_sql As SqlDataReader
Later I have to write double code to either use the OleDB-object or the SQL-object:
strSignal = oDR("Signal").toString
or
strSignal = oDR_sql("Signal").toString
But I do not want to double all the code where I use this objects because all fields I get from these objects are the same.
I think there must be a way / trick to do it. If you have a code-example I would be very lucky.
Sorry for my rusty English.
Yours, Michael
Dim oCON As OleDbConnection
Dim oCMD As OleDbCommand
Dim oCMD1 As OleDbCommand
Dim oDR As OleDbDataReader
Dim oDR1 As OleDbDataReader
Dim oCON_sql As SqlConnection As SqlConnection
Dim oCMD_sql As SqlCommand
Dim oCMD1_sql As SqlCommand
Dim oDR_sql As SqlDataReader
Dim oDR1_sql As SqlDataReader
Later I have to write double code to either use the OleDB-object or the SQL-object:
strSignal = oDR("Signal").toString
or
strSignal = oDR_sql("Signal").toString
But I do not want to double all the code where I use this objects because all fields I get from these objects are the same.
I think there must be a way / trick to do it. If you have a code-example I would be very lucky.
Sorry for my rusty English.
Yours, Michael