Diana_j86
What version of Visual Studio do you have?
In VS2005 you need to do the following:
1) Right click on your solution and select add, New Item.
2) Add a dataset and create your queries in the dataset. Make sure you save this dataset or it will not show up later.
3) Add your reportviewer
4) Right click on your solution and select add new Item Again and then add a crystal report
5) In the crystal report wizard Select crystal reports wizard and the type of report you want
6) Under the data menu you need to select project data, then ADO.NET datasets. Assuming you saved your dataset it will now show up in this field and you can make your selection as well as create your crystal report.
7) The code behind:
Dim dataSet As DataSet
Me.Cursor = Cursors.WaitCursor
Dim crReportDocument As CrystalReport1
Dim Con As SqlConnection
Dim Da As SqlDataAdapter
Dim conn As String = "Server=Your Server;Database=Your DB; User ID=sa;Password=Your PW"
Con = New SqlConnection(conn)
Dim sqlString As String = "This is where you can place your SQL query and pass all parameters i.e. ComboBox1.SelectedValue"
Dim cmSQL As SqlClient.SqlCommand
cmSQL = New SqlClient.SqlCommand(sqlString, Con)
Con.Open
Da = New SqlDataAdapter(sqlString, Con)
dataSet = New DataSet
Da.Fill(dataSet, "Dataset Name you created in steps above")
crReportDocument = New CrystalReport1
crReportDocument.SetDataSource(dataSet)
CView.ReportSource = crReportDocument
'crReportDocument.Load("~/CrystalReport1.rpt")
Con.Close
Please note that CView is the name of my report viewer.
Hope this helps