|
-
Dec 29th, 2010, 12:59 PM
#1
Thread Starter
New Member
How to use crystal report with VB.NET by passing the SQL statement?
How to use crystal report with VB.NET by passing the SQL statement?
Try to pass sql statement to a crystal report in vb.net 2008 after creating a dataset with it yet it will load the report but not showing the records, plsss help
-
Dec 29th, 2010, 01:49 PM
#2
Re: How to use crystal report with VB.NET by passing the SQL statement?
Welcome to the forums. 
Show us what you are doing, code wise, that isn't working.
-
Dec 29th, 2010, 08:51 PM
#3
Re: How to use crystal report with VB.NET by passing the SQL statement?
have a look at the dynamic crystal reports link in my signature
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 30th, 2010, 05:47 AM
#4
Thread Starter
New Member
Re: How to use crystal report with VB.NET by passing the SQL statement?
I try to pass sql statement to a crystal report in vb.net 2008 after creating a dataset and added it to the crystal report as datacolumn with it yet it will load the report but not showing the records, pls help
' The Code on theform with button and crystal reportviewer
Public Class Form1
Dim objRpt As New ReportDocument
'Dim objRpt As New CrystalReportsException
'select staffid,surname,othernames,deptcode from stafftab imagepath Dim img As String = My.Settings.imagepath
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using CCNN As New SqlConnection(My.Settings.bConn)
Dim sql As String
sql = "select staffid as Column1,surname as Column2,othernames as Column3,deptcode as Column4 from stafftab"
Dim dscmd As New SqlDataAdapter(sql, CCNN)
CCNN.Open()
Dim ds As New DataSet1
dscmd.Fill(ds, "stafftab")
objRpt.Load("Crstafflst.rpt")
objRpt.SetDataSource(ds.Tables(1))
CrystalReportViewer1.ReportSource = objRpt
CrystalReportViewer1.Refresh()
End Using
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim rptpathh As String = My.Settings.rptpath
Dim sDir As String = Directory.GetDirectoryRoot(Directory.Get… 3)
Dim sCurDir As String = Directory.GetCurrentDirectory.Substring(… 3) + rptpathh
Directory.SetCurrentDirectory(sCurDir)
Dim MDIParent1 As New MDIParent1
Me.MdiParent = MDIParent1.MdiParent
CrystalReportViewer1.RefreshReport()
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|