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 |
How to execute VB.NET PROJECTS,VB6.0 PROJECTS AND write their test cases.Need Reply Urgently
What is different between web.config and machine.config and where it will be ?
Why do you need Lock in Visual Basic?
Can we use Vb.Net and C# language simultaneously in one .Net application?
i had attended to infosys interview on 17th april 2010...on .net..3+ experience .. to my knowledge i did well in technical and they asked me to wait for next process ..so i waited for 15 min ..later one person came and said give 7-10 days time for intimation of next process do they keep technical and hr on different day ...or i loose the interview ..am confused yaar what accuatly would be happend
What are the types of generations in garbage collector?
What is static member?
What are the differences between vb.net and c#, related to oops concepts
How do you use two datareaders at the same time in a vb.net windows application ?
What is an indexed property?
What is intermediate langauge?
What is deep copy?