DbType vs SqlDbType

  • Thread starter Thread starter Bud J via DotNetMonster.com
  • Start date Start date
B

Bud J via DotNetMonster.com

I've been experimenting with various ways of "talking to the database" mainly
a low maintenance way to switch between sql and access. I've finally got
something a pretty comfortable with except for this

why does this work ok

param=new System.Data.SqlClient.SqlParameter();
param.DbType=paramType;
param.ParameterName=paramName;
param.SourceColumn=paramSourceColumn;
param.Size=paramSize;


and this does not

//now this will give a compile error about converting to sqldbtype from
dbtype
System.Data.IDbDataParameter param=new System.Data.SqlClient.SqlParameter
(paramName,paramType,paramSize,paramSourceColumn) ;

//so now i typecast wich does compile ok but doesn't work
System.Data.IDbDataParameter param=new System.Data.SqlClient.SqlParameter
(paramName,(System.Data.SqlDbType)paramType,paramSize,paramSourceColumn) ;


the first scenario works but it gives me concern that it may not be a good
thing to do
because otherwise i would expect an overload of the new SqlParameter to
include dbtype

Any explanation of what i'm missing would be greatly appreciated i've been
messing with this
for a couple of hours now
 
Back
Top