|
-
Mar 2nd, 2006, 02:14 AM
#1
Thread Starter
Member
[RESOLVED] Passing 'values' to generate reports
Hi
I'd like to generate reports based on values that the user is able to input. I need to generate reports during runtime. Tried most methods but not able to make it work.
I'm using an MS access Database, VB .net 2002, Crystal reports for .NET
below is the code that i've tried working with.
What I get is a dialog box which requests for UserName and password which i dont want displayed. How could I avoid that?
Please help.
VB Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
OleCon.Close()
Dim ADOcon As New ADODB.Connection()
ADOcon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\REPORTS_DB\TEST_CRY_0016.mdb;Jet OLEDB:Database Password=prax;"
OleCon.ConnectionString = ADOcon.ConnectionString
Dim repDA As New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM testinfo WHERE testscore > 50", OleCon)
Dim MyCmdBuilderDT_rep As New System.Data.OleDb.OleDbCommandBuilder(repDA)
repDA.Fill(repDS)
DataGrid1.DataSource = repDS.Tables(1)
MsgBox("pause")
rptCrewRecord.Load("..\CrystalReport2.rpt")
rptCrewRecord.SetDataSource(repDS)
Dim viewReport As New ReportView()
'Set the Parent Form of the Child window.
'Display the new
viewReport.ShowDialog()
End Sub
Last edited by Hack; Mar 2nd, 2006 at 07:32 AM.
Reason: Added [vbcode] [/vbcode] tags and for more clarity.
-
Mar 6th, 2006, 04:51 AM
#2
Thread Starter
Member
Re: Passing 'values' to generate reports
Solved this one myself, but with a little help from looking at codes posted on this forum, and here I am posting the code in case it might be of some help to someone who comes by here.
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim Appl As New CRAXDDRT20.Application()
Dim ADOcon As New ADODB.Connection()
Dim App As New Scripting.FileSystemObject()
Dim fso As New FileSystemObject()
Dim Conn As Connection
Dim strSQL As String
Dim Rs As ADODB.Recordset
Dim crewidSel As String = crewidX.SelectedValue
Conn = New Connection()
ADOcon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\REPORTS_DB\TEST_CRY_0016.mdb;Jet OLEDB: Database Password=prax;"
'OleCon.ConnectionString = ADOcon.ConnectionString
ADOcon.Open()
' MsgBox("crewidx.sel is " & crewidSel)
' crewidSel is the variable that i get from the form and create a
' RecordSet and finally view the recordset using Crystal Report view.
strSQL = "SELECT * FROM testinfo WHERE crewid = '" & crewidSel & "'"
Rs = New ADODB.Recordset()
Rs = ADOcon.Execute(strSQL)
Appl = New CRAXDDRT20.Application()
rptCrewRecord.Load("..\CrystalReport2.rpt")
rptCrewRecord.SetDataSource(Rs)
Dim viewReport As New ReportView()
viewReport.ShowDialog()
rptCrewRecord.Close()
End Sub
-
Mar 6th, 2006, 08:42 PM
#3
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
|