WalterHeisenberg
Technical User
- Mar 28, 2008
- 159
Hello,
I'm not very familiar with .net so bare with me. I've been following some different guides online with various results and finally think I am close.
Basically, I created a new web site project, I created a dataset (dataset1) and associated objects via wizard. I created a CrystalReport that uses this dataset as its datasource and has just the customer line in the details section.
Now, I'm hoping to dynamically be able to change this dataset so I can use this same template for various different reports. I added the following into my page load event:
When I run this it opens the crystal report but only shows the customer header not any of the details that should show up. Can anyone get me pointed in the right direction? Thanks!
Ariel
I'm not very familiar with .net so bare with me. I've been following some different guides online with various results and finally think I am close.
Basically, I created a new web site project, I created a dataset (dataset1) and associated objects via wizard. I created a CrystalReport that uses this dataset as its datasource and has just the customer line in the details section.
Now, I'm hoping to dynamically be able to change this dataset so I can use this same template for various different reports. I added the following into my page load event:
Code:
Dim myConnection As New Data.SqlClient.SqlConnection()
myConnection.ConnectionString = "server= PYRAMID;database=CUSMNG;Trusted_Connection=yes"
Dim MyCommand As New Data.SqlClient.SqlCommand()
MyCommand.Connection = myConnection
MyCommand.CommandText = "Select * from Customers where customer like 'ABC INC'"
MyCommand.CommandType = Data.CommandType.Text
Dim MyDA As New Data.SqlClient.SqlDataAdapter()
Dim ConnInfo As New ConnectionInfo
MyDA.SelectCommand = MyCommand
Dim myDS As New DataSet1()
MyDA.Fill(myDS, "DataSet1")
Dim oRpt As New ReportDocument()
oRpt.Load(MapPath("CrystalReport.rpt"))
oRpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = oRpt
When I run this it opens the crystal report but only shows the customer header not any of the details that should show up. Can anyone get me pointed in the right direction? Thanks!
Ariel