Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Encountered: Specified cast is not valid.

Status
Not open for further replies.

damann

Technical User
Jul 19, 2000
114
US
Hello Guys,

I'm getting this error whenever I try to call an oracle storeprocedure like this in a .NET (C#) app.

oracleConnection = (OracleConnection) ESDataAccessProvider.GetConnection("OracleDBConnString");
getDataOracleCommand = (OracleCommand) DAP.ConstructCommand("OracleDBConnString","Package.StoredProcedure");
getDataOracleCommand.Connection = oracleConnection;
OracleDataAdapter objDataAdapter = null;
objDataAdapter = new OracleDataAdapter();
objDataAdapter.SelectCommand = (OracleCommand) getDataOracleCommand;
objDataAdapter.Fill(MgrOrgDS);

Any idead why I get the "Error Encountered: Specified cast is not valid." error? Please let me know...


Thanks,
Damann
 
Which line do you get the cast error on?

ASP, VB, VBS, Cold Fusion, SQL, DTS, T-SQL, PL-SQL, IBM-MQ, Crystal Reports, Crystal Enterprise
 
The error happens at this line:

getDataOracleCommand = (OracleCommand) DAP.ConstructCommand



Here is the original code again:
oracleConnection = (OracleConnection) DAP.GetConnection("OracleDBConnString");
getDataOracleCommand = (OracleCommand) DAP.ConstructCommand("OracleDBConnString","Package.StoredProcedure");
getDataOracleCommand.Connection = oracleConnection;
OracleDataAdapter objDataAdapter = null;
objDataAdapter = new OracleDataAdapter();
objDataAdapter.SelectCommand = (OracleCommand) getDataOracleCommand;
objDataAdapter.Fill(MgrOrgDS);
 
I've figured out the problem guys, this post can go away now! Thanks!


Damann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top