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 |
what is vb,net
Why is the xml infoset specification different from the xml dom?
What is an arraylist?
How to connect crystal report in vb.net ?
Write a program to find all text files in a logical drive and return the count of the number of files?
What is late binding?
Explain the difference between an xml "fragment" and an xml "document."
Name the class which allows an element to be accessed using unique key?
Explain how does the xmlserializer work?
There are three versions of VB6--Learning Edition, Professional and Enterprise. Is VB.Net similar?
What are the differences between c# and visual basic.net?
What is the difference between vb 6 and vb.net?