Unable to bind crystal report when using dataset showing missing parameters

I have a crystal report that works great when I use DSN as a data source. The problem is that I'm using a dataset now. The dataset contains the entire table that I need, and I populate it with data from the database using a stored procedure. But, in this way, he throws an error: " Missing Parameters ".

I do as below:
Step 1 : create Dataset1.xsd and use data connections insert into it all the necessary tables from the database.
Step 2 Providing data source for a report using database expert as Dataset1.xsd
Step 3 : populate the data using the stored procedure in the dataset, then create an instance of Dataset1 and combine the data from the dataset into an instance of Dataset 1 .

My code is to retrieve data from a database, and then merge with an instance of Dataset1 and provide this as a crystal quality report as follows:

 Private Sub ReportByDataset(ByVal rptDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument) 'new code Dim myConnection As New SqlClient.SqlConnection() 'myConnection.ConnectionString = "server= (local)\NetSDK;database=pubs;Trusted_Connection=yes" Dim ds As New DataSet1 myConnection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("HighriseContractingWebConnectionString").ConnectionString myConnection.Open() Dim MyCommand As New SqlClient.SqlCommand() MyCommand.Connection = myConnection MyCommand.CommandText = "SP_Web_GetReportTables" MyCommand.CommandType = CommandType.StoredProcedure Dim MyDA As New SqlClient.SqlDataAdapter() MyDA.SelectCommand = MyCommand Dim myDS As New DataSet MyDA.Fill(myDS) myConnection.Close() ds.Tables("RABill_RPT").Merge(myDS.Tables(0), MissingSchemaAction.Ignore) myDS.Tables(0).Reset() ds.Tables("RA_bills").Merge(myDS.Tables(1), MissingSchemaAction.Ignore) ds.Tables("Work_Completion").Merge(myDS.Tables(2), MissingSchemaAction.Ignore) ds.Tables("contractor").Merge(myDS.Tables(3), MissingSchemaAction.Ignore) ds.Tables("WO_Header").Merge(myDS.Tables(4), MissingSchemaAction.Ignore) ds.Tables("Project").Merge(myDS.Tables(5), MissingSchemaAction.Ignore) ds.Tables("contractor_1").Merge(myDS.Tables(6), MissingSchemaAction.Ignore) ds.Tables("Users").Merge(myDS.Tables(7), MissingSchemaAction.Ignore) ds.Tables("Users_Approved").Merge(myDS.Tables(8), MissingSchemaAction.Ignore) ds.Tables("voucher").Merge(myDS.Tables(9), MissingSchemaAction.Ignore) ds.Tables("Employee_Approve").Merge(myDS.Tables(10), MissingSchemaAction.Ignore) ds.Tables("Employee").Merge(myDS.Tables(11), MissingSchemaAction.Ignore) ds.Tables("Account").Merge(myDS.Tables(12), MissingSchemaAction.Ignore) ds.Tables("TDS").Merge(myDS.Tables(13), MissingSchemaAction.Ignore) ds.Tables("WO_Detail").Merge(myDS.Tables(14), MissingSchemaAction.Ignore) ds.Tables("V_WO_BlockTaskNo").Merge(myDS.Tables(15), MissingSchemaAction.Ignore) ds.Tables("TASK").Merge(myDS.Tables(16), MissingSchemaAction.Ignore) ds.Tables("Cont_Voucher").Merge(myDS.Tables(17), MissingSchemaAction.Ignore) ds.Tables("Cont_Voucher_1").Merge(myDS.Tables(17), MissingSchemaAction.Ignore) ds.Tables("Cont_Voucher_2").Merge(myDS.Tables(17), MissingSchemaAction.Ignore) ds.Tables("Company").Merge(myDS.Tables(18), MissingSchemaAction.Ignore) ''new code ends rptDoc.SetDataSource(ds) CRReport.HasCrystalLogo = False CRReport.HasToggleGroupTreeButton = False CRReport.ReportSource = rptDoc CRReport.DataBind() End Sub 

But it does not work, which is what I am missing. The same works fine using DSN This is not a parameter problem, and the same works fine in a different way.
Note. I know that the code above is not optimized for memory, but now I'm worried about somehow making it work, I can optimize it later

Below is an image of Dataset1 as a data source
enter image description here

+5
source share
2 answers

Two possibilities - where do you get the parameters, missed errors? If it is in the SP_Web_GetReportTables stored procedure, you do not add any parameters for this sproc to MyCommand. If it is in the report itself, check it in the Field Explorer field on the side of the report itself and see if you have any parameters that remain from using DSN. Since you are currently directly passing the dataset, you do not need to pass any parameters. Finally, if it uses the Crystal Report report viewer, just the ReportSource setting should display it, I'm not sure what the DataBind does for you.

0
source

If you create a new data source and delete the old one, CR will also delete your parameters related to the query parameters for this data source. Better to change the data source.

0
source

All Articles