This is a migrated thread and some comments may be shown as answers.

sql parameter issue when using select * from table where id in @id format

3 Answers 244 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Peter Williams
Top achievements
Rank 1
Peter Williams asked on 06 May 2008, 11:39 PM
I am trying to use the following sql to generate my reports in reporting 1.1:

Me

.sqlSelectCommand1.CommandText = "SELECT * FROM [vwr_case_info] WHERE (accession_no IN (@accession_no))"

Me.sqlSelectCommand1.Connection = Me.sqlConnection1

Me.sqlSelectCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("accession_no", System.Data.SqlDbType.VarChar, 150, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "accession_no", System.Data.DataRowVersion.Current, "'tpc-07', 'tpc-08'")})

However, the report engine is not pulling any results for me.  When I change the sql to

Me

.sqlSelectCommand1.CommandText = "SELECT * FROM [vwr_case_info] WHERE (accession_no IN ('tpc-07', 'tpc-08'))"
everything works.  Am I missing something here or is there a bug in Telerk Reporting 1.1 when using sql parameters?

3 Answers, 1 is accepted

Sort by
0
Svetoslav
Telerik team
answered on 07 May 2008, 03:12 PM
Hello Peter Williams,

Telerik Reporting depends on the standard .NET data source objects for the report data source. For more information please see Connecting Data to a Report. This means that you are responsible for preparing the data for the report and the report displays it as is - in your case to pass a value for the  accession_no sql parameter (like in the 2nd code snippet). For an example please examine the Product Line Sales sample report (in both C# and VB.NET) which use similar approach to prepare the data for the Chart report item.

Currently we do support only Report Parameters which allow users to specify or control the data used in a report. Report Parameters are most powerful when used in expressions to directly provide a value or to form filtering, sorting or grouping criteria.

Sincerely yours,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Peter Williams
Top achievements
Rank 1
answered on 07 May 2008, 05:36 PM
I am using version reporting 1.1 and I can't find report parameters from its documentation.  Does 1.1 version supports report parameters?  Can you point me to a sample on how to use it in version 1.1 if it does support that?  Thanks.
0
Ivan
Telerik team
answered on 08 May 2008, 10:14 AM
Hello Peter,

Unfortunately version 1.1 of Telerik Reporting does not support Report Parameters - they are introduced in version 1.5. But you can preview this video where design time support for parameterized sql queries is discussed. Please try this approach and let me know if you have any other questions.

Best wishes,
Ivan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Peter Williams
Top achievements
Rank 1
Answers by
Svetoslav
Telerik team
Peter Williams
Top achievements
Rank 1
Ivan
Telerik team
Share this question
or