📄 valueread_asnumeric.html
字号:
<html><head><meta name="KEYWORDS" content=" library, C++, Oracle, SQLServer, DB2, Sybase, Informix, InterBase, SQLBase, ODBC,
SQL, server, client, database, programming, development, software,
Win32, Windows, Linux, Unix, Solaris,
Microsoft, Borland, Centura, Gupta, IBM"><meta name="DESCRIPTION" content=
"SQLAPI++ is C++ library for accessing SQL databases (Oracle, SQLServer, Sybase, DB2, InterBase, SQLBase, Informix, ODBC).
It uses native APIs, provides low-level access to database-specific features."><title>SQLAPI++ Library - Online Documentation - SAValueRead::asNumeric</title></head><body bgcolor="#ffffff" BACKGROUND="../images/bg.gif" text="#000000"><!--GlbHdr--> <table WIDTH="600" height="40" frame="hsides" BORDER="2" BORDERCOLOR="#004fcd" align="right" cellpadding="0" cellspacing="2" id="TABLE1">
<tr><!--class="GlbDefault"-->
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A style="TEXT-DECORATION: none" href="/index.html" >
<font color="white" size="3" face="sans-serif">
<b>Home</b></font></A></td></TD>
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A style="TEXT-DECORATION: none" href="/HowTo/index.html" > <font color="white" size="3" face="sans-serif">
<b>How To</b></font></A></td><!--class="GlbActive"-->
<td width="70" bgcolor="#00bb00" bordercolor="black" align="middle"><A style="TEXT-DECORATION: none" href="/OnLineDoc/index.html" > <font color="white" size="3" face="sans-serif">
<b>Online Documentation</b></font></A></td><!--class="GlbDefault"-->
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A style="TEXT-DECORATION: none" href="/Support/index.html" > <font color="white" size="3" face="sans-serif">
<b>Support</b></font></A></td>
<td width=70 bgcolor=#000094 bordercolor=black align=middle><A style="TEXT-DECORATION: none" href ="/Download/index.html" >
<font color=white size=3 face=sans-serif>
<b>Download</b></font></A></td>
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A style="TEXT-DECORATION: none" href="/Order/index.html" > <font color="white" size="3" face="sans-serif">
<b>Order</b></font></A></td> </tr>
</table>
<p> </p>
<p> </p>
<table width="100%">
<tr>
<td valign="top" width="165"><!--LeftMenu-->
<table frame="void" CELLSPACING="5" width="165">
<tr><td><p> </p></td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A style="TEXT-DECORATION: none" href="Command.html" >
<font color="white" size="2" face="sans-serif">
SACommand</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A style="TEXT-DECORATION: none" href="Connection.html" >
<font color="white" size="2" face="sans-serif">
SAConnection</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A style="TEXT-DECORATION: none" href="Exception.html" >
<font color="white" size="2" face="sans-serif">
SAException</font></A> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A style="TEXT-DECORATION: none" href="Field.html" >
<font color="white" size="2" face="sans-serif">
SAField</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A style="TEXT-DECORATION: none" href="Param.html" >
<font color="white" size="2" face="sans-serif">
SAParam</A> </FONT> </td>
</tr>
<tr><td><hr></td></tr>
<tr>
<td><img align=middle src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A style="TEXT-DECORATION: none" href ="String.html" >
<font color=white size=2 face=sans-serif>
SAString</A>
</FONT> </td>
</tr>
<tr>
<td><img align=middle src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A style="TEXT-DECORATION: none" href ="DateTime.html" >
<font color=white size=2 face=sans-serif>
SADateTime</A> </FONT> </td>
</tr>
<tr>
<td><img align=middle src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A style="TEXT-DECORATION: none" href ="Numeric.html" >
<font color=white size=2 face=sans-serif>
SANumeric</A> </FONT> </td>
</tr>
<tr><td><hr></td></tr>
<tr>
<td>
<A style="TEXT-DECORATION: none" href ="Enums.html" >
<font color=white size=2 face=sans-serif>
Enums and Typedefs</A>
</FONT> </td>
</tr>
</table>
</td><!--empty column-->
<td width="20">
<p> </p>
</td><!--Content-->
<td valign="top" align="left">
<table width="100%" cellspacing="2" cellpadding="2">
<tr>
<td align="left"><A style="TEXT-DECORATION: none" href="ValueRead_Usage.html" ><h3>Usage</h3></A>
</td>
<td align="left"><A style="TEXT-DECORATION: none" href="ValueRead.html" ><h3>Class Members</h3></A>
</td>
<td align="left"><A style="TEXT-DECORATION: none" href="ValueRead_Examples.html" ><h3>Examples</h3></A>
</td>
</tr>
<tr>
<td colspan="3"><h1
>SAValueRead::asNumeric</h1></td>
</tr>
</table>
<p><font face="Arial"><b> SANumeric asNumeric() const;<BR> </b></font>
<STRONG><FONT face=Arial>throw
(SAException);</FONT></STRONG></p>
<p><STRONG><FONT
face=Arial>operator SANumeric( ) const;<BR
>throw (SAException);</FONT></STRONG></p>
<p><STRONG>asNumeric</STRONG>
method
returns the value of current object (usually
<A href="Field.html">SAField</A>
or <A href="Param.html">SAParam</A>
object) as <STRONG>SANumeric</STRONG>
data.
</p>
<p><STRONG>operator
SANumeric()</STRONG> substitute <STRONG>asNumeric</STRONG> method to provide quick access for object's
value.</p>
<h3>Remarks</h3>
<P>If the value of current object is NULL,
<STRONG>asNumeric</STRONG> method returns
<STRONG>0</STRONG>. Use <FONT color=mediumblue face=""><A
href="ValueRead_isNull.html">SAValueRead::isNull</A></FONT>
method
to make sure if the value is NULL or not.</P>
<P>If the value's type of current object is
exact numeric value (<STRONG>SA_dtNumeric</STRONG>),
<STRONG>asNumeric</STRONG> method returns the original value with no
conversion.</P>
<P>If the value's type of current object is
bool (<STRONG>SA_dtBool</STRONG>),
short (<STRONG>SA_dtShort</STRONG>),
double (<STRONG>SA_dtDouble</STRONG>)
or long (<STRONG>SA_dtLong</STRONG>),
<STRONG>asNumeric</STRONG> method converts it to
<STRONG>SANumeric</STRONG> .</P>
<P>If the value's type of current object is
string (<STRONG>SA_dtString</STRONG>),
<STRONG>asNumeric</STRONG> method tries to convert it from
<STRONG>SAChar*</STRONG>
value. If the
conversion is possible and correct, <STRONG>asNumeric</STRONG> converts to
<STRONG>SANumeric</STRONG> from
<STRONG>SAChar*</STRONG> value. If conversion is
incorrect <STRONG>asNumeric</STRONG> method
throws an exception.</P>
<P>If the value's type of current object is any data
type except the described above, the result is undefined and debug version
asserts.</P>
<P>Use <A href="ValueRead_DataType.html" >SAValueRead::DataType</A> method to get the
value's type of <STRONG>SAValueRead</STRONG>
object.</P>
<h3>Server specific notes</h3>
<P>No specific information.</P>
<h3> See also</h3>
<P><A href="ValueRead_isNull.html">isNull</A>, <A
href="ValueRead_asBool.html">asBool</A>,
<A href="ValueRead_asShort.html">asShort</A>, <A
href="ValueRead_asLong.html">asLong</A>, <A
href="ValueRead_asDouble.html">asDouble</A>, <A
href="ValueRead_asDateTime.html">asDateTime</A>, <A
href="ValueRead_asString.html">asString</A>, <A
href="ValueRead_asBytes.html">asBytes</A>, <A
href="ValueRead_asLongBinary.html">asLongBinary</A>, <A
href="ValueRead_asLongChar.html">asLongChar</A>, <A
href="ValueRead_asBLob.html">asBLob</A>, <A
href="ValueRead_asCLob.html">asCLob</A>, <A
href="ValueRead_asCursor.html">asCursor</A>, <A
href="ValueRead_DataType.html">DataType</A>
</P>
<P><A href="Enums.html#SADataType_t" >SADataType_t</A> </P>
<P><A href="../HowTo/errors.html" >Error handling</A></P>
<h3>Problems and Questions</h3>
<p> If
you haven't found the answer to your questions or
have some problems on using the Library, please, send e-mail to <A href="mailto:howto@sqlapi.com">howto@sqlapi.com</A>.
</p>
</td>
<tr></tr>
</table>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -