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

📄 sqlserver_oledb.html

📁 能够连接各种数据库的API
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<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 - Server Specific Guide - SQL Server (OLE DB)</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 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>&nbsp;

<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="100%">
	<tr>
		<td valign=top width=165><!--class="LeftMenu"-->
			<table frame=void CELLSPACING=5 width=165>
				<tr>
					<td><p><br></p></td>
				</tr>
				<tr>
					<td><img align=middle src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A style="TEXT-DECORATION: none" href  ="../OnLineDoc/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  ="../OnLineDoc/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  ="../OnLineDoc/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  ="../OnLineDoc/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  ="../OnLineDoc/Param.html" >
					<font color=white size=2 face=sans-serif>
					SAParam</A> 
            </FONT> </td>
				</tr>
				<tr>
					<td><img align=middle src="../images/green.gif" WIDTH="12" HEIGHT="12">
					<A style="TEXT-DECORATION: none" href  ="../OnLineDoc/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  ="../OnLineDoc/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  ="../OnLineDoc/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  ="../OnLineDoc/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>
			<center>
            <H2><A href="index.html">Server Specific Guide</A></H2>
			<h1>SQL Server<BR>(OLE DB)</h1>
            <P align=left>SQLAPI++ allows to work with a number of SQL database 
            servers. It provides common mechanisms to access database, and as a 
            general rule they work for any database server. But each server has 
            some specific features which developer has to know to use all 
            server's capability and avoid potential errors.</P>
            <P align=left>This page collects all <STRONG>specific</STRONG> information that concerns 
            working with <STRONG> SQL Server (OLE DB 
            API)</STRONG>
                   using SQLAPI++ 
            Library. Full information about using SQLAPI++ see in <A 
            href="../HowTo/index.html">How To</A>
            and <A 
            href="../OnLineDoc/index.html">Online Documentation</A> 
                   . 
            </P>
            <P align=left>Available topics: 
            </P>
			</center>
            <P><A 
            href="SQLServer_OleDb.html#Connecting to a database">Connecting to a 
            database</A></P>
            <P><A 
            href="SQLServer_OleDb.html#Transaction isolation levels">Transaction 
            isolation levels</A></P>
            <P><A 
            href="SQLServer_OleDb.html#Working with Long or Lob(CLob, BLob) data">Working with 
            Long or Lob(CLob, BLob) data</A></P>
            <P><A 
            href="SQLServer_OleDb.html#Returning output parameters">Returning output parameters</A></P>
            <P><A href="SQLServer_OleDb.html#Cancelling queries">Cancelling 
            queries</A></P>
            <P><A 
            href="SQLServer_OleDb.html#Connection and command options">Connection, 
            command, parameter and 
            field options</A></P>
            <P><A 
            href="SQLServer_OleDb.html#Getting native SQL Server API"> Getting native SQL Server (OLE DB) API</A></P>
            <P><A 
            href="SQLServer_OleDb.html#Getting native SQL Server connection related handles"> Getting 
            native SQL Server (OLE DB) connection related 
            handles</A></P>
            <P><A 
            href="SQLServer_OleDb.html#Getting native SQL Server command related handles"> Getting 
            native SQL Server (OLE DB) command related 
            handles</A></P>
            <P><A href="SQLServer_OleDb.html#Error handling">Error 
            handling</A></P>
            <P><A href="SQLServer_OleDb.html#Special header files - Compile time">Special header files - Compile time</A></P>
            <P>&nbsp;</P>
            
            <H3><A 
            name="Connecting to a database">Connecting to a database</A>   </H3>
            <p>To connect to a database you should create a 
            connection object and then connect it. A connection object is 
            represented by <A href="../OnLineDoc/Connection.html" >SAConnection</A> 
            class.</p>
            <P align=left>Starting from version 3.3.1 
            SQLAPI++ Library uses <U>OLE DB as the default 
            API</U> when working with <STRONG>SQL 
            Server</STRONG>. It means that the Library sets the default value of 
            "<STRONG>UseAPI</STRONG>" <A href="SQLServer_DbLibrary.html#Connection and command options" >connection 
            option</A> as "<STRONG>OLE DB</STRONG>". </P>
            <p>If the Library cann't find <STRONG>OLE 
            DB</STRONG> interface it throws an 
            exception.</p>
            <p> 
             After the connection is created you need to connect it to 
            <STRONG>SQL Server</STRONG>
            using <A href="../OnLineDoc/Connection_Connect.html" >SAConnection::Connect</A> 
            method</p>
            <p><font face=Arial><b 
            >void Connect( const SAString 
            &amp;</b>sDBString<b>, const SAString 
            &amp;</b>sUserID<b>, const SAString 
            &amp;</b>sPassword<b>, SAClient_t</b> 
            eSAClient<b> = 
  SA_Client_NotSpecified );</b> <BR></font></p>
            <p>with the following parameters:</p>
            <P><EM>sDBString.</EM> 
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; One of the following       
               formats:</P>
            <UL>
                <LI><STRONG>"" 
                or "@"</STRONG> - empty string or '@' character, 
                connects to a default database on a local server. 
                <LI><STRONG>&lt;database 
                name&gt; or @ <STRONG>&lt;database name&gt; 
                </STRONG></STRONG>- connects to a database with the specified 
                name on your local server. 
                <LI><STRONG>&lt;server 
                name&gt;@ </STRONG>- connects to a default database on the 
                specified server. 
                <LI><STRONG>&lt;server 
                name&gt;@&lt;database name&gt; </STRONG>- connects to a database 
                with the specified name on the specified server.</LI></UL>
            <P>To connect to a named instance of SQL Server 2000 use 
            <STRONG>&lt;server name\instance name&gt;</STRONG> instead of 
            <STRONG>&lt;server name&gt;</STRONG>.</P>
            <P><EM>sUserID.</EM>&nbsp;&nbsp;&nbsp; A string containing a user 
            name to use when establishing the connection. If <EM>sUserID</EM> parameter is empty, SQLAPI++ Library requests a 
            secure, or trusted, connection to SQL Server.<BR> 
                    
                 <BR><EM>sPassword.</EM>&nbsp;&nbsp;&nbsp; A 
            string containing a password to use when establishing the 
            connection.<BR>     
                  <BR><EM>eSAClient.</EM>&nbsp;&nbsp;&nbsp; Optional. One of the 
            following values from <STRONG>SAClient_t</STRONG> enum:
            <UL>
                <LI><STRONG>SA_SQLServer_Client</STRONG>&nbsp;&nbsp;&nbsp; 
                SQLServer client.
                <LI><STRONG>SA_Client_NotSpecified</STRONG>&nbsp;&nbsp;&nbsp;&nbsp; 
                Used by default if <EM>eSAClient</EM>parameter is 
                omitted.&nbsp; You can use this default value only if you have 
                call <A 
                href="../OnLineDoc/Connection_setClient.html">SAConnection::setClient</A> 
                method with <STRONG>SA_SQLServer_Client</STRONG> constant before.</LI> 
            </UL>
            <P>The SQLAPI++ Library requires SQL Server OLE DB 
            version 2.5 or higher.</P>
            <P>For more details see <A 
            href="../HowTo/connect.html">How To - Connecting to databases</A>, <A 
            href="../OnLineDoc/Connection_Usage.html">SAConnection object</A>, <A 
            href="../OnLineDoc/Connection_Connect.html">SAConnection::Connect</A>.</P>
            <P>&nbsp;</P>
            
            <H3><A 
            name="Transaction isolation levels">Transaction isolation 
            levels</A>  </H3>
            <P>SQL-92 defines four isolation levels, all of 
            which are supported by SQLAPI++:</P>
            <UL>
                <LI>Read uncommitted (the lowest level where 
                transactions are isolated just enough to ensure that physically 
                corrupt data is not read) 
                <LI>Read committed 
                <LI>Repeatable read 
                <LI>Serializable (the highest level, where 
                transactions are completely isolated from one another)</LI></UL>
            <P>SQLAPI++ maps different isolation levels on 
            <STRONG>SQL Server (OLE DB)</STRONG>  in the following way:</P>
            <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <STRONG 
            >SA_ReadUncommitted</STRONG> = 
            ISOLATIONLEVEL_READUNCOMMITTED  ('Read 
            Uncommitted')<BR><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SA_ReadCommitted</STRONG> = ISOLATIONLEVEL_READCOMMITTED  
            ('Read Committed')<BR><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SA_RepeatableRead</STRONG> = 
            ISOLATIONLEVEL_REPEATABLEREAD  
            ('Repeatable  
            Read')<BR><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SA_Serializable</STRONG> = ISOLATIONLEVEL_SERIALIZABLE  
            ('Serializable')</P>
            <P>For more details see <A 
            href="../OnLineDoc/Connection_setIsolationLevel.html">SAConnection::setIsolationLevel</A>.</P>
            <P>&nbsp;</P>
            
            <H3><A 
            name="Working with Long or Lob(CLob, BLob) data">Working with Long or Lob(CLob, 
            BLob) data</A>    </H3>
            <P> 
            SQLAPI++ supports four types for working with 
            Lob(CLob, BLob) data:</P>
            <P>
            <TABLE border=1 cellPadding=1 cellSpacing=1 style="WIDTH: 100%" 
            width="100%">
                
                <TR bgColor=navy>
                    <TD><FONT color=white 
                        style="BACKGROUND-COLOR: #000080">Name</FONT></TD>
                    <TD><FONT color=white 
                        style="BACKGROUND-COLOR: #000080">C 
                        enum constant</FONT></TD>
                </TR>

⌨️ 快捷键说明

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