|
-
Dec 8th, 2006, 06:02 AM
#1
Thread Starter
Hyperactive Member
report database change
Hi
I call the crystal report in vb.net 2003 by below mention method
but it will work if the database is same on which the crystal report
is designed. but if i change the database on runtime then the report will
not display the data from assign database table.
VB Code:
Private Sub cmdprint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdprint.Click
Dim fReportViewer As New frmReportViewer
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
fReportViewer.MdiParent = MainForm
fReportViewer.Show()
Me.Cursor = Cursors.WaitCursor
Try
CrRepDoc.Load(Application.StartupPath & "\Report\Master\StatusMaster.rpt")
CrRepDoc.Refresh()
For Each tbCurrent In CrRepDoc.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = gl_Server
.DatabaseName = gl_DataBase
.UserID = gl_User
.Password = gl_PassWord
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent
fReportViewer.ReportViewerSales.ReportSource = CrRepDoc
Catch Exp As Exception
MsgBox(Exp.Message, MsgBoxStyle.Critical, "General Error")
End Try
Me.Cursor = Cursors.Default
End Sub
-
Dec 12th, 2006, 06:25 AM
#2
Addicted Member
Re: report database change
Well , first of all try not to use database name directly , try to use with DSN or any other method. Secondly if the database changes then u must do "Verify Database" first , otherwise it will give an error.
Thanks and Regards,
Muhammad Abbas
-
Dec 12th, 2006, 07:36 AM
#3
Thread Starter
Hyperactive Member
Re: report database change
can you give an example of any other method other than DSN
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|