Can someone please tell me what i am doing wrong with this code.
I have created a dataset and want to push that data into crystal reports.
Dim rpt As New CrystalReport1() 'The report you created.
Dim myConnection As SqlConnection
Dim MyCommand As New SqlCommand()
Dim myDA As New SqlDataAdapter()
Dim myDS As New DataSet2() 'The DataSet you created.
Try
myConnection = New SqlConnection("Data Source=localhost;Initial Catalog=maintsystem;Persist Security Info=True;User ID=mbish;Password=mbish")
MyCommand.Connection = myConnection
MyCommand.CommandText = "SELECT * FROM Hardware"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "dataset2")
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = "c:\CrystalReport2.rpt"
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub