Re: How cast result of executescalar to a integer
- From: "Stephen Howe" <stephenPOINThoweATtns-globalPOINTcom>
- Date: Wed, 7 Dec 2005 18:23:21 -0000
> I am tring to use execute scalar which returns an object *.
> If I assign result of executescalar to an variable defined as an object *
it
> compiles and runs. But this value is actually an integer and I can not
> figure out how to convert it to an integer.
> I would prefer if I did not need to assign it to object variable at all
but
> assigned it directly to an integer value.
>
> Below is currently what I am doning and I have not found the proper way to
> cast to int.
> Object *leadskip;
> leadskip = cmd->ExecuteScalar();
What kind of object is is cmd?
It cannot be a Command Object in ADO as there is no method called
ExecuteScalar.
It looks like ADO.NET. In that case you have the wrong newsgroup.
This newsgroup is for classic ADO, pre-.NET.
There is another newsgroup specifically for ADO.NET.
Also by the looks of it here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlclientsqlcommandclassexecutescalartopic.asp
you want something like
int val = (int)cmd->ExecuteScalar():
or
int val = (int)*cmd->ExecuteScalar():
Stephen Howe
.
- Prev by Date: RE: MDAC install hang
- Next by Date: Difference between ODBC and OLEDB connections
- Previous by thread: RE: MDAC install hang
- Next by thread: Difference between ODBC and OLEDB connections
- Index(es):
Relevant Pages
|
|