Microsoft KB Archive/325811

= CERowset Sample That Executes a Query and Opens a Rowset on a Session =

Article ID: 325811

Article Last Modified on 8/4/2004

-

APPLIES TO


 * Microsoft SQL Server 2000 Windows CE Edition 1.1
 * Microsoft SQL Server 2000 Windows CE Edition 1.1 Service Pack 1

-



This article was previously published under Q325811



SUMMARY
The CERowset.exe sample contains code that demonstrates how to execute a query on a particular command, and how to then open a rowset at the same time off the same session object (without closing the session.)



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

CERowset.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How To Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

The CERowset.exe file contains the following files:

How to Build the Sample
To build the sample, follow these steps:  Open the CERowset.cpp file in the eMbedded Visual C++ IDE. Press F7 to build the sample. When prompted to create a new workspace, click Yes. On the Project menu, click Settings. In the Settings dialog box, click the Link tab. Type the name of these additional library files in Object/Library modules text box:

 Oledb.lib Ole32.lib Oleaut32.lib Uuid.lib</li></ul>

</li> Select the appropriate device and CPU type.</li> On the Tools menu, click Options, and then click Directories. Verify that the appropriate SQL Server CE and Data Access 3.1 Include folders and Library folders are listed there. The Include and Library files for SQL Server CE are in the \Lib and \Inc subfolders of the SQL Server CE installation folder. The Include and Library files for OLE DB and SQL Server CE are in the \Include and \Lib subfolders of Dataaccess31. You must use the Library file that matches the processor and platform for which you are compiling.

</li> Build, and then deploy the sample.</li></ol>

Methods Included in the Sample
CreateDB: Creates a new database through OLE DB.

InsertData: Creates two tables (one named test and the second named test2) and inserts the data &quot;NULL&quot;,1,2,3 into each table.

ExecuteSQL: Executes a non row returning SQL statement.

ExecuteJoinQuery: Executes a query that joins the two tables, test and test2, off an existing session object.

WinMain: Main method that calls all the earlier methods. Then, WinMain uses the same session to call IOpenRowset::Openrowset two times (one time for the test table and the second time for the test2 table).

<div class="references_section">