473,395 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

generating a crystal report depending on the selected item in a dropdownlist

How to generate a Crystal Report depending on the selected Item in a dropdownlist using vb?

Thanks,
Sep 24 '07 #1
1 2228
dip_developer
648 Expert 512MB
How to generate a Crystal Report depending on the selected Item in a dropdownlist using vb?

Thanks,
Depending on the SelectedItem of combobox your sql query will be changed.....

So try something like...

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim mySqlString As String 
  3. Select Case mydrodown.SelectedItem.Text 
  4. Case "FirstItem" 
  5. mySqlString="Select A From myTable1" 
  6. Case "SecondItem" 
  7. mySqlString="Select B From myTable2"
  8. End Select
  9.  
1.now populate a DataSet (say myDataset) with query mySqlString
2.set your Crystal report(say myReport) DataSource property to myDataset
3.set your CrystalReportViewer(say myCRV) ReportSource property to myReport

try this.....

Expand|Select|Wrap|Line Numbers
  1.  
  2. If myDataset.Tables(0).Rows.Count = 0 Then 
  3. MsgBox("NO RECORD FOUND", MsgBoxStyle.Critical)
  4. Else
  5. Dim myReport As New CrystalReport1
  6. myReport .SetDataSource(myDataset)
  7. myCRV.ReportSource = myReport 
  8. End If
  9.  
Sep 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: vickie | last post by:
I have a sql server7 database using C#. The system runs fine until the user try to run a report. I get the following error: Object reference not set to an instance of an object. Description: An...
1
by: Aaron Prohaska | last post by:
I'm having the problem with this drop down list on postback. For some reason both the ListItems get selected when I change the selected item. Using the code below I'm building the drop down list in...
10
by: dhnriverside | last post by:
Hi guys Still having a problem with this dropdownlist. Basically, I've got 4. The first 2 work fine, then my code crashes on the 3rd. ddlEndTimeHour.Items.FindByValue(endTime).Selected =...
11
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
3
by: Iain | last post by:
Hi All I have 2 DropDownList boxes on a page. The first (id= "Operation") is populated on PageLoad with the contents of a database table. The second id="WorkStations" will not be populated...
0
by: zellipa | last post by:
I am trying to imbed crystal in oracle. I got the following steps from the web. when i try to run the created from , iget the error frm-41344. Any suggestions. Regards, Zellipa STEPS TO...
4
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the...
1
by: Rodo | last post by:
Hi all, I'm trying to generate a simple crystal report without a database. Several people mention the use of a dataset. Someone mention in a msdn forum that I could use the SetParameterValue to...
0
by: amiga500 | last post by:
Hello, I am developing a crystal report called Expense Report (I am not an expert Crystal Report designer) if someone could help me in this problem I would be greatly appreciate it. The report...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.