how to connect crystal report with vb.net ?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / vinod kondhalkar
1)how to connect crystal report with vb.net ?
2)how to pass the parameter?
Is This Answer Correct ? | 15 Yes | 9 No |
Answer / dinesh sharma
Follow These Steps:
Click on Project menu
-->then Click Add New Item
-->Choose Crystal Report
-->Give the name of the report that you want to give
-->Click on Add Report
and also
-->Click Add New Dataset(.XSD File)
-->Right Click on That File Add Table Adapter
-->Make Connection and Write The Query and Follow The Step
as Come In Wizard
-->The In Blank Report Go Field Explore
-->DataBase Fields and Chose ADO.NET Dataset it The Table
you have Create in Dataset
-->Now Drag and Drop it in You Reports
Is This Answer Correct ? | 13 Yes | 13 No |
Answer / kafeel ahmad
Take crystal report from toolbox .Take New form (I named it
frmRpt)Then take crystal report Viewer from tool box and
place it on new form(frmRpt) I named crystal report Viewer
as crptVW
double click on newform(frmRpt) and place this code---
Public Class frmRpt
Public strRptName As Object
Public strRptFilter As String
Private Sub frmRpt_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
If strRptFilter <> "" Then
crptVW.SelectionFormula = strRptFilter
End If
crptVW.ReportSource = strRptName
crptVW.Show()
End Sub
End Class
now if u want to call it on button_click then paste this
code on that button_click event ------
Dim objRpt As New frmRpt
objRpt.strRptName = New crList
' objRpt.strRptFilter = "{ConsultantMaster.ConId}="
& cboConIDX.SelectedValue 'if want to filter
objRpt.Show()
'now u can open as many crystal report just paste code
above on button_click()
Is This Answer Correct ? | 8 Yes | 8 No |
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 ?
What is globalization?
Explain what observations between vb.net and vc#.net?
What is JIT(Just In Time) and How it works?
5 Answers Data Entry Operator, Infocons, Siemens,
How do you declare static variable and how it is declared and what is its lifetime?
Explain code security?
How can we store decimal data in .net?
What is the feature anonymous type?
Explain the difference between value and reference types?
difference between control and component more than one differences
What is the difference between manifest and metadata?
Can you please explain the difference between system.string and system.stringbuilder classes?