|
-
Nov 20th, 2002, 02:47 PM
#1
Thread Starter
Hyperactive Member
Pass a Public Variable to Crystal Report
Hello,
Is there any way to pass a Public VB Variable to a Crystal Report to use in its forumla? I need to select a name out of a combobox and then use that text to pull information from the orcale database and show it in the crystal report? If thats possible any help or links related to it you could give me would be great. Thanks in advance
-
Nov 20th, 2002, 03:07 PM
#2
Member
Let me preface this with "I use MS SQL not Oracle" so if there are differences I apologize.
Why not pass the name from the combobox to your SELECT statement that you use to fill the dataset.
This Will require that you use a "Typed Report".
<perform on generate report button click>
sqlSelectCommand.Parameters("@name").value = cboName.text
sqlSelectCommand.CommandText = "SELECT * from Table where name like @name"
DataAdapter.fill(dsYourDataset.Table)
crReportName1.SetDataSource(dsYourDataset.Table)
crvReportViewer.ReportSource(crReprtName1)
Hope this helps.
Last edited by EagleEye; Nov 20th, 2002 at 03:11 PM.
-
Nov 20th, 2002, 03:36 PM
#3
Thread Starter
Hyperactive Member
Dim DA As New OleDb.OleDbDataAdapter("SELECT dic01_last_name ||', '|| dic01_first_name as Name, from dic01_student where dic01_student_id = 108 order by dic01_first_name", CN)
Dim DS As New DataSet()
DA.Fill(DS)
act.SetDataSource(DS.Tables)
crView.ReportSource = act
I tried that, and the dataset filled fine, but the crystal report wont show anything, this is my first time messing with crystal reports, so i might be a little slow. thanks for the help though. I will work with it a little more and see if i can figure out another way. Any ideas and i would be grateful.
Last edited by Tool; Nov 20th, 2002 at 03:40 PM.
-
Nov 20th, 2002, 04:21 PM
#4
Member
You have to use both a typed dataset and a typed report based off that typed data set. Otherwise the report won't know what data goes where.
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
|