T
Tom Winter
I'm trying to put together a generic Command object that my business objects
can use to access my applications database. We're starting with an MDB and
then maybe moving to SQL Server and then maybe SQL Mobile.
So my code in the business objects is working with the "generic"
IDbConnection, IDbCommand, IDataParameter interfaces, instead of directly
with OleDbCommand or SqlCommand. The problem is, with
IDbCommand.Parameters.Add, you need pass it a fully formed Parameter object.
It doesn't have an AddWithValue method like OleDbCommand.Parameters. The big
question here is what to set the DbType to for an IDataParameter object that
I get from IDbCommand.CreateParameter(). IDataParameter.DbType wants a
System.Data.DbType. OleDb appears to use OleDbType and SQL uses SqlDbType.
It doesn't look like the values map to each other. What should I use here?
Can I just not fill in the Type property and let the system figure it out?
(I know I can use the System.Data.Common objects, but those still have the
same issue.)
Thanks for your help!
Tom Winter
(e-mail address removed)
can use to access my applications database. We're starting with an MDB and
then maybe moving to SQL Server and then maybe SQL Mobile.
So my code in the business objects is working with the "generic"
IDbConnection, IDbCommand, IDataParameter interfaces, instead of directly
with OleDbCommand or SqlCommand. The problem is, with
IDbCommand.Parameters.Add, you need pass it a fully formed Parameter object.
It doesn't have an AddWithValue method like OleDbCommand.Parameters. The big
question here is what to set the DbType to for an IDataParameter object that
I get from IDbCommand.CreateParameter(). IDataParameter.DbType wants a
System.Data.DbType. OleDb appears to use OleDbType and SQL uses SqlDbType.
It doesn't look like the values map to each other. What should I use here?
Can I just not fill in the Type property and let the system figure it out?
(I know I can use the System.Data.Common objects, but those still have the
same issue.)
Thanks for your help!
Tom Winter
(e-mail address removed)