shahram197070
یک شنبه 09 اسفند 1388, 20:44 عصر
با سلام
دوستان محترم
از تابع زیر برای نمایش گزارشام استفاده می کنم در هنگام بارگزاری گزارش در بهترین حالت حدود 40 ثانیه طول می کشه !!!!!
کسی می دونه مشکل کد زیر چیه ؟
Public Function DatabaseLogon(ByRef ViewReport As ReportDocument) As ReportDocument
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As New CrystalDecisions.Shared.TableLogOnInfo
Dim ConnectInfo As New CrystalDecisions.Shared.ConnectionInfo
With ConnectInfo
.ServerName = ServerName
.UserID = UserName
.Password = UserPass
.DatabaseName = DataBase
End With
Try
'Resetting connection information for each table that your report will be using.
For Each tbCurrent In ViewReport.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
tliCurrent.ConnectionInfo = ConnectInfo
tbCurrent.ApplyLogOnInfo(tliCurrent)
'Important 1: This code below very important, it will help your program re-setting location for connection.
If (tbCurrent.TestConnectivity() = False) Then
Return Nothing
Else
If (tbCurrent.Location.IndexOf(".") > 0) Then
tbCurrent.Location = tbCurrent.Location.Substring(tbCurrent.Location.La stIndexOf(".") + 1)
Else
tbCurrent.Location = tbCurrent.Location
End If
End If
'End - Important 1
Next tbCurrent
Return ViewReport
Catch ex As Exception
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information)
Finally
End Try
End Function
دوستان محترم
از تابع زیر برای نمایش گزارشام استفاده می کنم در هنگام بارگزاری گزارش در بهترین حالت حدود 40 ثانیه طول می کشه !!!!!
کسی می دونه مشکل کد زیر چیه ؟
Public Function DatabaseLogon(ByRef ViewReport As ReportDocument) As ReportDocument
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As New CrystalDecisions.Shared.TableLogOnInfo
Dim ConnectInfo As New CrystalDecisions.Shared.ConnectionInfo
With ConnectInfo
.ServerName = ServerName
.UserID = UserName
.Password = UserPass
.DatabaseName = DataBase
End With
Try
'Resetting connection information for each table that your report will be using.
For Each tbCurrent In ViewReport.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
tliCurrent.ConnectionInfo = ConnectInfo
tbCurrent.ApplyLogOnInfo(tliCurrent)
'Important 1: This code below very important, it will help your program re-setting location for connection.
If (tbCurrent.TestConnectivity() = False) Then
Return Nothing
Else
If (tbCurrent.Location.IndexOf(".") > 0) Then
tbCurrent.Location = tbCurrent.Location.Substring(tbCurrent.Location.La stIndexOf(".") + 1)
Else
tbCurrent.Location = tbCurrent.Location
End If
End If
'End - Important 1
Next tbCurrent
Return ViewReport
Catch ex As Exception
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information)
Finally
End Try
End Function