S VK

S VK

  • NA
  • 13
  • 0

setting userid password servername for crystal report in vb.net application

Jan 28 2011 12:57 AM

in my vb.net windows application i made a setup for the application from my development system
the application is having reports generated with inbuilt crystal report

the setup takes the the datasource server name as my   development system
& is working fine

but wehn i deploy it to the cleint system the application  without crystal report works fine
i made changes in the app.config file of the client & set it datasource to their sql server name
but when i try to open the report teh datasource takes my  development system name  & its disabled
& it aslo ask me for userid & password

i tried by creating a setup using mergemodule & ran the setup on client machine
but stil the same issue
how do i open crystal report by taking the connection string specified in app.config

i am trying using the below code
Private
Sub bill1_InitReport(ByVal sender As Object, ByVal e As System.EventArgs) Handles bill1.InitReport
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
With crConnectionInfo
.ServerName = ConfigurationManager.AppSettings(
"ServerName") 'YOUR SERVER NAME"
.DatabaseName = ConfigurationManager.AppSettings(
"MainData") 'YOUR DATABASE NAME"
.UserID = ConfigurationManager.AppSettings(
"User_ID") 'YOUR DATABASE USERNAME"
.Password = ConfigurationManager.AppSettings(
"Password") 'YOUR DATABASE PASSWORD"
End With
 

Dim ReportName As String = "Bill.rpt"
' Dim ReportName As String = "individual_bill.rpt"
ReportName = Application.StartupPath &
"\" & ReportName & ""
Dim ReportForm As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
ReportForm.Load(ReportName)
 
 
CrTables = ReportForm.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
 
 
Next
CrystalReportViewer.ReportSource = ReportForm
CrystalReportViewer.Refresh()
 
but when i exeute i get error msg "value cannot be null"
 
i have designd the report  & had set its datasource using selection expert in the design view mode
how & wht cahnges needs to be made so that the reports will be loaded without asking fir username & password  & by taking the right server name
 
 

Answers (4)