I know to work with VB.net + crystal report + SQL server.
But now i want to work with SQL server compact edition instead of SQL server.
When we creating Crystal report it is asked provider in one moment. If we work with SQL server we select "Microsoft OLE DB provider for SQL server".
I want to know

(Q1) what I should select as provider.

(Q2)After clicking next, it is asked SERVER. what should i typed. (When i use sql server i typed, "MyName-PC\SQLEXPRESS")

Please Help Me.....

Dani AI

Generated

Short answer: design the report against a typed ADO.NET DataSet (XSD) and bind a filled DataSet at runtime. SQL Server Compact Edition (SQL CE) is a file-based .sdf engine, so there is no server name to put into the Crystal Database Expert the way you do for full SQL Server. This follows ’s hint to “use dataset” and clarifies that ’s server/integrated-security advice applies to the full SQL Server product, not to SQL CE.

Typical workflow

  1. Add a new DataSet (XSD) to the project and create a DataTable with the columns the report needs.
  2. In the Crystal Report designer use Database Expert → Project Data → ADO.NET Datasets and pick your XSD. Lay out fields against that schema.
  3. At runtime open the .sdf with System.Data.SqlServerCe, fill the typed DataSet, then call report.SetDataSource(...) and assign the report to the viewer.

Example VB.NET runtime snippet:

Dim conn As String = "Data Source=|DataDirectory|\MyDb.sdf"
Using cn As New System.Data.SqlServerCe.SqlCeConnection(conn)
    Dim da As New System.Data.SqlServerCe.SqlCeDataAdapter("SELECT * FROM MyTable", cn)
    Dim ds As New MyTypedDataSet()   ' the XSD-generated class
    da.Fill(ds, "MyTable")
    Dim rpt As New MyCrystalReport()
    rpt.SetDataSource(ds)
    CrystalReportViewer1.ReportSource = rpt
End Using

Troubleshooting/caveats: make sure the XSD table name matches the table name you fill; call SetDataSource before setting ReportSource; set the .sdf Copy to Output Directory or use an absolute path; add a reference to System.Data.SqlServerCe and include the SQL CE runtime on target machines. If you see native DLL load errors, verify your project’s platform target (x86/x64) matches the installed CE runtime. Using a typed DataSet avoids fiddling with provider/server settings in the report wizard and is the most reliable approach for SQL CE.

Recommended Answers

All 3 Replies

DATASET?
Will you please elaborate.

I know to work with VB.net + crystal report + SQL server.
But now i want to work with SQL server compact edition instead of SQL server.
When we creating Crystal report it is asked provider in one moment. If we work with SQL server we select "Microsoft OLE DB provider for SQL server".
I want to know

(Q1) what I should select as provider.

(Q2)After clicking next, it is asked SERVER. what should i typed. (When i use sql server i typed, "MyName-PC\SQLEXPRESS")

Please Help Me.....

If its a windows authentication in ur SQL server then u can use as follows

Server Name: MyName-PC\SQLEXPRESS

Integrated Sercurity checkbox as checked

then the username and password gets disabled

click on Database... ur database will come in the drop down....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.