Saturday, July 2, 2011

How do I use SQLExpress with Crystal Reports ?

There are two ways to do this: Using "OLE DB(ADO)" connection or "ADO.NET Dataset"

Let's explore :

1.Create a database in the SQLExpress instance using the

Server Explorer->Data Connections->Right Click->Create New SQL Server Database

Database created this way will be directly available in the

Database Expert->Create New Connection->OLE DB(ADO) option.

The "OLE DB(ADO)" wizard will start. If it does not
start, click on "Make New Connection" to start it.

In the "OLE DB Provider" box, select "OLE DB Provider for SQL Server"
(Even selecting "SQL Server Native Client 10.0" is OK) and click next.

If your express server does not appear in the
"Connection Information" box, type ".\SQLExpress" in the "Server" combo.

When you check "Integrated Security" , credentials will not be asked.

The database you created from Server Explorer will be available in the
"Database" combo.

2. If you do not want to create a database in the SQLExpress instance,
but instead want to work with .mdf  file, you need to take a different
approach :

Create the mdf file.
Then add a new item to the project, "Dataset". This
will add "Dataset1.xsd" to the project and open the Dataset designer.

In the dataset designer, drag all the required tables from server

Now when you open Database Expert, "Dataset1" will appear in
"Project Data"->"ADO.NET Datasets".

No comments:

Post a Comment