⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bind.html

📁 通用的数据库中间库
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<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 - How To - Binding Input Parameters</title></head><body bgcolor="#ffffff" BACKGROUND="../images/bg.gif" text="#000000"><!--class="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 href="../index.html" style="TEXT-DECORATION: none" >
			<font color=white size=3 face=sans-serif>
			<b>Home</b></font></A></td></TD>
		<!--class="GlbActive"-->
        <td width=70 bgcolor=#00bb00 bordercolor=black align=middle><A href="../HowTo/index.html" style="TEXT-DECORATION: none" >
			<font color=white size=3  
      face=sans-serif>
			<b>How To</b></font></A></td>
		<!--class="GlbDefault"-->
        <td width=70 bgcolor=#000094 bordercolor=black align=middle><A href="../OnLineDoc/index.html" style="TEXT-DECORATION: none" >
			<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 href="../Support/index.html" style="TEXT-DECORATION: none" >
			<font color=white size=3  
            face=sans-serif>
			<b>Support</b></font></A></td>
        <td width=70 bgcolor=#000094 bordercolor=black align=middle><A href="../Download/index.html" style="TEXT-DECORATION: none" >
			<font color=white size=3  
            face=sans-serif>
			<b>Download</b></font></A></td>
        <td width=70 bgcolor=#000094 bordercolor=black align=middle><A href="../Order/index.html" style="TEXT-DECORATION: none" >
			<font color=white size=3  
      face=sans-serif>
			<b>Order</b></font></A></td>
    </tr>
</table>

<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="100%" cellpadding=1 cellspacing=1>
	<tr>
		<td valign="top" align=left><!--class="LeftMenu"-->
			<table frame="void" CELLSPACING=2 cellpadding=2 width=165>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A href="connect.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Connecting to databases</font></A> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A href="transactions.html" style ="TEXT-DECORATION: none" >
					<font color="white" face="sans-serif" size=2>
					Transactions</font></A> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A href="commands.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Executing an SQL command</A> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A href="procedures.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Executing stored procedures</A> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/red.gif" WIDTH="12" HEIGHT="12" 
                        style="HEIGHT: 12px; WIDTH: 12px">
					<A href="bind.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Binding input parameters</A> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A href="fetch.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Fetching result set</A> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12" 
                       >
					<A href="fetch_multiple.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Fetching multiple result sets</A> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12" 
                       >
					<A href="performance.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Optimizing Database Performance</A> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A href="return_param.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Returning output parameters</A> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A href="blobs.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Working with 
					Long or Lob(CLob, BLob) Data</A> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">	<A href="datetime.html" style="TEXT-DECORATION: none">
					<font color="white" size="2" face="sans-serif">
					Working with date/time values</a> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A href="errors.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Error handling</A> </FONT> </td>
				</tr>
				<tr>
					<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A href="query_exampl.html" style ="TEXT-DECORATION: none" >
					<font color="white" size="2" face="sans-serif">
					Query examples</A> </FONT> </td>
				</tr>
			</table>
		</td>
		<td width="30">
			<p>  </p>
		</td>
		<td valign="top">
			<center>
			<h1>Binding Input Parameters</h1>
			</center>
			<p>You should assign values for input variables 
            any time you want to execute an SQL command or a stored procedure with input parameters.</p>
            <P>Suppose, we want to insert some rows into the table <EM 
            >EMPLOYEES ( NAME CHAR(25), AGE INTEGER, COMMENT CHAR(25)).</EM> In 
            the following examples we'll consider the different methods to write 
            the appropriated command text and bind input variables: </P>
            <UL>
                <LI><A 
                href="bind.html#Assigning a value with SAParam object">assigning 
                a value to <STRONG>SAParam</STRONG> 
                object</A>; 
                <LI><A href="bind.html#Using the stream operator<<" >using the 
                stream <STRONG>operator&lt;&lt;</STRONG></A>.</LI></UL>
            <H2><A name="Assigning a value with SAParam object">Assigning a value with SAParam object</A><A name="Assigning a value with SAParam object"> 
            </A></A></H2>
            <P><A href="../OnLineDoc/Param.html">SAParam</A> object represents a 
            parameter object associated with a command.</P>
            <H3>Example 1. </H3>
            <P>Let's execute the next SQL command to insert a row into the 
            table:</P>
            <P><EM>insert into 
            EMPLOYEES (NAME, AGE, COMMENT) values (:1, :2, :3)</EM></P>
            <P>This command has three input parameters to set values to 
            <EM>NAME, AGE</EM> and <EM>COMMENT</EM> columns.&nbsp; In that example input parameters 
            are marked by <EM>:1, :2, :3</EM>. It means we will identify a 
            parameter by its <STRONG>position</STRONG>     . </P>
            <P>To create and execute the command we should do the following:</P>
            <OL>
                <LI>Create a command object <EM>cmd</EM>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -