|
-
Jul 26th, 2005, 12:28 PM
#1
Thread Starter
Addicted Member
Problem with stored procedure and crystal
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..
-
Jul 26th, 2005, 12:50 PM
#2
Thread Starter
Addicted Member
Re: Problem with stored procedure and crystal
OK how can I get a dataset I have created and populated in code to be the same as a physical dataset in the form designer which needs to be passed to crystal?
-
Jul 26th, 2005, 01:07 PM
#3
Thread Starter
Addicted Member
Re: Problem with stored procedure and crystal
Please help - I have a bit of a deadline now seen as though the stored procedure part took me about 25 hours. What is my best bet? I need a strongly typed dataset for crystal but cannot fill it from code properly from my stored procedure?
-
Jul 26th, 2005, 01:56 PM
#4
Thread Starter
Addicted Member
Re: Problem with stored procedure and crystal
Is there any way I can do this at all? The stored procedure produces the correct results - all I need now is to get those results into a stongly typed dataset to add on to my crystal report - I can't believe this has taken me 3 days...
-
Jul 26th, 2005, 02:23 PM
#5
Frenzied Member
Re: Problem with stored procedure and crystal
Offhand, I don't see anything wrong. I do this in my reports as well, use ReportClass.SetDataSource(Dataset). Are you sure there's data in your Dataset? And it's the same Dataset the report is using?
-
Jul 26th, 2005, 02:30 PM
#6
Thread Starter
Addicted Member
Re: Problem with stored procedure and crystal
Yeah - I think it's because my stored procedure has a temp table - I'm going to do this another way now I think...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|