The SQL Client and Store sample is an example of a service talking to a back-end SQL database (in this case a Microsoft SQL database). The sample is generic in that it can be used against any SQL database without recompilation; everything needed to communicate with the backend service is specified as part of the persistent state of the SQL client service. The sample illustrates:
- How to connect to a back-end Microsoft SQL database using the SqlConnection and SqlDataAdapter classes from ADO.NET.
- How to map from the DataSet to the DSSP operations (see Accessing DSS Services through DSSP including GET, QUERY, INSERT, UPDATE, UPSERT, and DELETE)
This tutorial is provided in the C# language. You can find the project files for this tutorial at the following location under the Microsoft Robotics Developer Studio installation folder:
Samples\Enterprise\DataBases\AdoNet\SqlClient
Table of Contents:
Prerequisites
Hardware
This tutorial requires no special hardware.
Software
This tutorial is designed for use with Microsoft Visual C#. You can use:
- Microsoft Visual C# Express Edition
- Microsoft Visual Studio Standard, Professional, or Team Edition.
This sample communicates with Microsoft SQL Server. You can use:
- SQL Server 2005 Express Edition
- or any of the full SQL Server 2005 editions.
You will also need Microsoft Internet Explorer or another conventional web browser.
Setting Up the Sample Database
In this tutorial we're using SQL Server Express Edition which should be installed with the named instance of SQLEXPRESS.
The default configuration is set up to talk to the NorthWind sample database which must be downloaded and installed separately. After downloading SQL2000SampleDb.msi, extract the sample database scripts by double-clicking SQL2000SampleDb.msi. This will extract the database scripts and its readme file into this default folder: "C:\SQL Server 2000 Sample Databases". To install the sample databases, follow the instructions in the README file in that folder.
This sample was tested by installing the Northwind sample database by typing the following from a CMD prompt. Replace ComputerName with localhost or the name of the computer where you want to install the database.
cd /d "C:\SQL Server 2000 Sample Databases"
osql -E -S ComputerName\SQLEXPRESS -i instnwnd.sql
Getting Started
This sample demonstrates how to build a service DSS front-end to a SQL database.
For detailed information on this sample, please see the remaining topics in this section starting with SQL Service Overview.