Object must implement IConvertible.

B

Bill Cart

This is a question from a confused newbe.I have an oldDbCommand component
called oleDbCmdAddDemoReq and an oldDbConnection called oleDbConDemoReq on a
web form. I have the following code:

oleDbConDemoReq.Open();
oleDbCmdAddDemoReq.ExecuteNonQuery();
oleDbConDemoReq.Close();

I get this error message:

Object must implement IConvertible.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Object must implement
IConvertible.

The error is comming form the ExecuteNonQuery command. I don't understand
what I am doing wrong.
 
G

Greg Ewing [MVP]

Bill, what is oleDbCmdAddDemoReq set up to do? Is it trying to return a
value? Does it have parameters? What is probably happening is that the
query has parameters and it is not able to convert to the requested format
from whatever value you are setting it to. If you want to post the code
that sets up the query we can probably help more.
 
B

Bill Cart

Yes it does have parameters and that seems to be what the problem was. The
error message did not give me much of a clue as to what the real problem
was.

I think that a lot of the problem is that I am using C# standard. If I
understand it correctly this can only work with oldDb. The problem is that I
have MSDE installed and when I drag a datset onto a form it creates an
sqlConnection and an sqlDataAdapter but I can't use them because the C#
standard only supports ado. This is a real problem for a beginner like me
because all of the examples in the books always use sql instead of oldDb. I
was able to convert it but that is just one more headache when I am trying
to learn something. It would be great is the C# standard was smart enough to
use only the types it supports. Or did I miss something somewhere?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top