CERowset Sample That Executes a Query and Opens a Rowset on a Session (325811)



The information in this article applies to:

  • Microsoft SQL Server 2000 Windows CE Edition 1.1
  • Microsoft SQL Server 2000 Windows CE Edition 1.1 SP1

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: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:

File nameSize
CERowset.cpp17 KB
Readme.txt2 KB


How to Build the Sample

To build the sample, follow these steps:
  1. Open the CERowset.cpp file in the eMbedded Visual C++ IDE.
  2. Press F7 to build the sample. When prompted to create a new workspace, click Yes.
  3. 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

  4. Select the appropriate device and CPU type.
  5. 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.

  6. Build, and then deploy the sample.

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 "NULL",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).

REFERENCES

SQL Server CE 1.1 Readme.txt file; "Developing with Microsoft eMbedded Visual C++" SQL Server CE Books Online

Modification Type:MinorLast Reviewed:8/4/2004
Keywords:kbdownload kbfile kbinfo KB325811