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 |
Explain internal keyword in .net framework?
what is difference between web.config and machine.config and where it will be ?
What is intermediate langauge?
Name some different types of control?
Which is the tool which can convert visual basic old version to .net compatibility version?
Observations between vb.net and vc#.net?
Explain the difference between datatable and dataset?
Is VB.NET object oriented? What are the inheritances does VB.NET support ?
13 Answers Digital GlobalSoft, Global Infotech, Infosys,
Trace and Debug belongs to which namespaces?
how to call a list box on the text if some one send me the code for it
What are the parts of the visual basic control?
I want to sample Hotel management project in vb.net because still now i am doing that project for small hotel....so please send me my email id is jmuthu_pearls@yahoo.com...
4 Answers Sapphire Comfort Hotel, TATA,