DbType is not set implicitly
Posted by: Timothy Graupmann
Date: January 11, 2005 02:54PM

I ended up using this hack, since the DbType is not set implicitly.

#region MySQL DbType Connection Hack for Reggie ;P

private static void AddDbTypeToParameter(IDbCommand myCommand,
IDbDataParameter p)
{
if(p.Value is String)
p.DbType = DbType.String;
else if(p.Value is DateTime)
p.DbType = DbType.DateTime;
else if(p.Value is UInt32)
p.DbType = DbType.UInt32;
else if(p.Value is Int16)
p.DbType = DbType.Int16;
else if(p.Value is Double)
p.DbType = DbType.Double;
else if(p.Value is Byte[])
p.DbType = DbType.Byte;
myCommand.Parameters.Add(p);
}

#endregion

Now instead of calling:
myCommand.Parameters.Add(p);

I call:
AddDbTypeToParameter(myCommand, p);

Is there a faster way?

Options: ReplyQuote


Subject
Written By
Posted
DbType is not set implicitly
January 11, 2005 02:54PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.