Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to connect crystal report with vb.net ?

Answer Posted / himanshu

Public Sub ReportView(ByVal RepoPath As String, Optional
ByVal param As String = "")
Dim ConInfo As New
CrystalDecisions.Shared.TableLogOnInfo
Dim objReport As New
CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim strParamenters As String = param
Dim strParValPair() As String
Dim index As Integer
Dim strVal() As String
Dim Para As String
Dim Val As String

objReport.Load(RepoPath)
If Trim(param) <> "" Then
strParValPair = strParamenters.Split("&")
For index = 0 To UBound(strParValPair)
If InStr(strParValPair(index), "=") > 0 Then
strVal = strParValPair(index).Split("=")
Para = strVal(0)
Val = strVal(1)
objReport.SetParameterValue(Para, Val)
End If
Next
End If
LoginCR(objReport)

For Each Table As
CrystalDecisions.CrystalReports.Engine.Table In
objReport.Database.Tables
ConInfo = Table.LogOnInfo
ConInfo.ConnectionInfo.UserID = "UserName"
ConInfo.ConnectionInfo.Password = "Password"
ConInfo.ConnectionInfo.ServerName = "Your
Server Name"
ConInfo.ConnectionInfo.DatabaseName
= "Attendance"
Table.ApplyLogOnInfo(ConInfo)
Next

FrmCrystalRptViewer.CrystalReportViewer1.DisplayGroupTree =
False

FrmCrystalRptViewer.CrystalReportViewer1.ReportSource =
Nothing

FrmCrystalRptViewer.CrystalReportViewer1.ReportSource =
objReport
FrmCrystalRptViewer.Show()

FrmCrystalRptViewer.CrystalReportViewer1.DisplayGroupTree =
False
FrmCrystalRptViewer.CrystalReportViewer1.Show()
End Sub
Private Sub LoginCR(ByRef CRep As
CrystalDecisions.CrystalReports.Engine.ReportDocument)
Dim LogonInfo As
CrystalDecisions.Shared.TableLogOnInfo
For Each Table As
CrystalDecisions.CrystalReports.Engine.Table In
CRep.Database.Tables
ConInfo = Table.LogOnInfo
ConInfo.ConnectionInfo.UserID = "UserName"
ConInfo.ConnectionInfo.Password = "Password"
ConInfo.ConnectionInfo.ServerName = "Your
Server Name"
ConInfo.ConnectionInfo.DatabaseName
= "Attendance"
Table.ApplyLogOnInfo(LogonInfo)
Next
End Sub

Is This Answer Correct ?    17 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is portable executable?

1245


How do you retrieve the customized properties of a .net application from xml .config file?

1030


What is the top .net class that everything is derived from?

1104


Write the role of new keyword?

1196


i have two class that contain's two methods as same name in derived class i have to call these two methods what will happen at run time ?

2713


What is deep copy?

988


What is the ruby interface generator?

1088


When do you use virutal keyword?

1042


Name the class which allows an element to be accessed using unique key?

1054


What’s the difference between private and shared assembly?

1170


Explain how to store decimal data in .net?

1218


List the different types of assembly?

980


Explain i.tostring method?

976


Explain cts?

1007


Which is the tool which can convert visual basic old version to .net compatibility version?

1013