Monday, March 19, 2012

Crystal Report using SQL CE

I've created an app that connects to a SQLCE database. I need to create Crystal Reports that connect to the database. There is no ODBC driver for SQLCE. How can I do this?

Thanks,

Kathy

Can you use OLEDB with Crystal Reports, the provider name is:

PROVIDER=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0

|||

Erik, I'm missing something along the way.

I've ran C:\WINDOWS\system32\regsvr32.exe sqlceoledb30.dll but don't see sqlserver mobile 3.0 under the OLEDB connections I can define in Crystal. I've also tried sending the connection through code and get the following error. Public member 'DataSourceConnections' on type 'Crystal Report Class'

Errors at

rpt.DataSourceConnections.Item(0).SetConnection("", "" & path1 & "\sales_quote.sdf", False)

Code:

Dim rpt As New Quote " name of report

Private Sub loadreport(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim path1 As String = My.Application.Info.DirectoryPath '' path

Dim con As New OleDbConnection("Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=|DataDirectory|\sales_quote.sdf")

Dim com As New OleDbCommand(" SELECT Quote_Header.Quote_Num, CUSTOMER.sh_name, CUSTOMER.sh_street," & _

"FROM ((Quote_Header Quote_Header INNER JOIN Quote_Line Quote_Line ON " & _

"Quote_Header.Quote_Num=Quote_Line.MQUOTE_NUM) LEFT OUTER JOIN SALESMAN SALESMAN ON Quote_Header.Salesman=SALESMAN.sm_salenum)" & _

"LEFT OUTER JOIN CUSTOMER CUSTOMER ON Quote_Header.ShipNum=CUSTOMER.sh_shipnum " & _

"WHERE Quote_Header.Quote_Num='" & 18 - 2209 - 7 & "' ORDER BY Quote_Line.QUOTE_AREA")

com.CommandType = CommandType.Text '' command type

com.Connection = con '' give connection to command

Dim adp As New OleDbDataAdapter '' declare adapter

adp.SelectCommand = com '' select command for adpapter to work on

Dim ds As New DataSet '' delcare dataset

adp.Fill(ds, "sales_quote") '' fill the dataset through adapter

Try

rpt.DataSourceConnections.Item(0).SetConnection("", "" & path1 & "\sales_quote.sdf", False)

'rpt.DataSourceConnections.Item(0).SetLogon("admin", "")

Catch exp As Exception

MsgBox(exp.Message)

End Try

rpt.DataSource = ds '' select the Dataset to the source of the report

CRViewer1.ReportSource = rpt '' assign the report to the crytal reprot viewr (cr1)

Can you tell me how to set the connection through Crystal Reports set database location or what I'm missing in my code.

Thanks,

|||

I don't understand the purpose of this line of code:

rpt.DataSourceConnections.Item(0).SetConnection

You already have filled a dataset (ds), and set this dataset to the datasource of the report.

Excuse my Crystal ignorance....

|||

I want to create a report with crystal report 9 and my database is sql server ce on pocket pc. How I connect to tables on sql server ce inside crystal report? I install sql server 2005 on my pc but there is'nt any provider in crystal report 9 that I can connect to tables on sql server ce. please help me.thank you

|||

i have the same prob to connect to SQL CE with CR11 ,the sqlceoledb30.dll is not realized by CR11

|||

Please contact Crystal support with this issue.

|||

Has anyone found out how to do this? Any replies from Crystal?

I've been looking around the net and haven't found any info on how to use Crystal with sql ce.

|||

In case anyone's still looking, I finally got around this by using XML data definitions. A good example can be found here:

http://www.vbdotnetheaven.com/UploadFile/krishnajina/CrystalReportwithXmlInVB11102005001552AM/CrystalReportwithXmlInVB.aspx

No comments:

Post a Comment