Using Programming Interfaces

The APIs available for use with SQL Server Compact 4.0 when you use Microsoft Visual Studio 2010 SP1 as the development environment are:

  • .NET Compact Framework data providers.

    • System.Data.SqlServerCe namespace (for use with SQL Server Compact).

  • OLE DB provider for SQL Server Compact (uses Microsoft eMbedded Visual C++ [eVC++] language).

Note Note

To work with a database, an API does the following:

  1. Opens a connection to the database.

  2. Sets options that control certain behaviors, such as whether cursors will be used, what type of cursor will be used, and whether updates are permitted.

  3. Executes an SQL statement. Optionally, the application can also use program variables to supply parameter values for the executed statement. An application can execute only one statement at a time on each connection, or it can execute several at the same time.

  4. Moves the data values of return codes, output parameters, and result sets into program variables, where they can be used by the application logic. If the statement returns its result set in the form of an XML document, the application can stream that to a component that consumes XML documents.

  5. Disconnects when finished working in the database.

    The programmer must understand both SQL statements and the appropriate use of the database API.