Reputation: 15
I have a problem
I am a project worker vb.net 2015 with sql
After I cleared the project and tried the project at the client
An error appears when the reports are shown by the crystal Report
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim rpt As New WaznRep
For Each DSC As CrystalDecisions.Shared.IConnectionInfo In rpt.DataSourceConnections
DSC.SetLogon(muser, mpass)
DSC.SetConnection(mserver, mdb, False)
Next
ReportV1.CrystalReportViewer1.ReportSource = rpt
ReportV1.ShowDialog()
End Sub
whereas
mserver = server
mdb = the name of the database
muser = username sql
mpass = sql password
They are retrieved from a text file
When running the program when the client does not open the report
This message appears and the name of the database is empty
and i used anther code to connect
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button3.Click
Application.DoEvents()
Dim rpt1 As New WaznRep
Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo
ConInfo.ConnectionInfo.ServerName = mserver
ConInfo.ConnectionInfo.DatabaseName = mdb
ConInfo.ConnectionInfo.UserID = muser
ConInfo.ConnectionInfo.Password = mpass
rpt1.Database.Tables(0).ApplyLogOnInfo(ConInfo)
ReportV1.CrystalReportViewer1.ReportSource = rpt1
ReportV1.CrystalReportViewer1.RefreshReport()
ReportV1.ShowDialog()
End Sub
anther
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim cryRpt As New ReportDocument
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
Dim rpt1 As New WaznRep
cryRpt.Load("D:\1.rpt")
With crConnectionInfo
.ServerName = mserver
.DatabaseName = mdb
.UserID = muser
.Password = mpass
End With
CrTables = cryRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
ReportV1.CrystalReportViewer1.ReportSource = cryRpt
ReportV1.CrystalReportViewer1.RefreshReport()
ReportV1.ShowDialog()
End Sub
all code working in my PC but Not Working in client PC
in my PC and client PC same Crystal report version
Edit----
Dim rpt As New WaznRep
For Each DSC As CrystalDecisions.Shared.IConnectionInfo In rpt.DataSourceConnections
DSC.SetConnection(mserver, mdb, False)
DSC.SetLogon(muser, mpass)
Next
rpt.SetDatabaseLogon(muser, mpass)
ReportV1.CrystalReportViewer1.ReportSource = rpt
ReportV1.ShowDialog()
when i use integrated security=false
db name not show
when i use integrated security=true
Dim rpt As New WaznRep
For Each DSC As CrystalDecisions.Shared.IConnectionInfo In rpt.DataSourceConnections
DSC.SetConnection(mserver, mdb, True)
DSC.SetLogon(muser, mpass)
Next
rpt.SetDatabaseLogon(muser, mpass)
ReportV1.CrystalReportViewer1.ReportSource = rpt
ReportV1.ShowDialog()
db name show but not work in client pc
Upvotes: 1
Views: 609
Reputation: 15
The problem was solved the solution
must install the NATIVE SQL driver to get access to Crystal Reports.
Upvotes: 0