Hi all - thanks to everyone who helped with my other thread...
Decided to go down the route of the stored procedure. This works fine and I can populate a datagrid with the results.
I created a dummy datadapter with the fields that would be produced by my stored procedure and created a dataset (dsyearlyturnover) to be filled by my stored procedure. I then created a crystal report from that dataset but I cannot seem to get any data picked up on it... the datagrid fills out fine so I know the data is there:
VB Code:
Me.DsYearlyTurnover1.Clear() Dim orpt As New rptyearlyturnover() Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand("sp_invoices", SqlConnection1) sqlCommand.CommandType = CommandType.StoredProcedure sqlCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@clientid", Me.ComboBox1.SelectedValue)) sqlCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@datefrom", ("04/01/" & Me.ComboBox2.Text))) sqlCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@dateto", ("03/31/" & CInt(Me.ComboBox2.Text) + 1))) 'Create a SqlDataAdapter to talk to the database Dim da As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter() da.SelectCommand = sqlCommand 'Create a DataSet to hold the results Dim ds As DataSet = New DataSet() 'Fill the Dataset da.Fill(DsYearlyTurnover1) orpt.SetDataSource(DsYearlyTurnover1) Me.CrystalReportViewer1.ReportSource = orpt SqlConnection1.Close()
Hopefully a bit easier than my last question
I think I must have missed out something obvious..





Reply With Quote