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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ExecuteScalar method of OracleCommand object

Status
Not open for further replies.

CraigBest

Programmer
Aug 1, 2001
545
US
Hope someone can answer this for me...

I'm using the Oracle Data Provider to access data from an Oracle Database in a VB.NET program I'm writing. I'm using the data provider successfully to return datasets, but I wanted to use a method of the OracleCommand object called ExecuteScalar to return single-field values from the DB. However, when I use it I'm not getting back the string (text) values I espect, I'm getting back decimal values instead.

Have I made a mistake? Does this method only return decimal values? Is there a better method for me to get back single text values from the DB that I should try?

Help please! Thank you.

CraigHartz
 
You should be able to return a string without issue. I think you will have much more luck if you a) post your code (vb.net and b) post this in the VB.NET forum instead...Assuming that your oracle stored proc. works as intended in SQL*Plus..HTH.

 
Hi Rhythm,

Yes, you are right -- I traced the problem to trying to stuff the returned value into an object and not a string variable. When I made that change it worked properly. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top