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

Query designer issues

2 Answers 209 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 07 Jun 2017, 07:08 PM

Hi,

I'm using Visual Studio 2015 w/Telerik R1 2017 & SQL Server 2012.

 

Having a strange issue when configuring a report source.

1. Under Configure data connection choose an existing (good) data connection.

2. Click next and select 'Use as Shared Connection'

3. Click next and enter my SQL statement.  The first statement is an @declare.  Followed by some select statements to get the data.  It's a fairly simple 6-table join (works in SSMS).

4. Open the query builder.  Gives message 'The Declare SQL construct or statement is not supported.'  Click Ok and then Execute Query.  The same records are returned as when running the query in SSMS.

5. After configuring the data source and design time parameters I get to the preview screen.

6. Click Execute Query.  Get message 'The variable name @CustomerNumber' has already been declared...'  It's using the same parameters as step 4.

 

Questions:

In step #4 the SQL query runs in spite of the message 'The Declare SQL construct...'.  Does this mean the query is Ok or not?  If not Ok then why is data returned from the query builder?  The SQL is valid in SSMS so I would expect the same to be used when in the designer.  The message 'The Declare SQL construct...' is troubling as this is a normal part of SQL Server.  So does the Telerik designer support the FULL implementation of SQL Server?

In step #6 the error message is misleading.  The variable is only declared one time.  How can I get past the error message?

 

Thanks,

Jim B

2 Answers, 1 is accepted

Sort by
0
Accepted
Jim
Top achievements
Rank 1
answered on 07 Jun 2017, 08:40 PM

Never mind.  I changed to use a stored procedure.

Was having other issues returning from the temp table.  Found a Microsoft **fix**.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/2e8b86eb-9c3d-439f-a904-b457ad9c0a2c/defining-a-stored-proc-for-use-with-dataset-using-tableadapter-wizard?forum=vbgeneral

 

IF 1=0 BEGIN
    SET FMTONLY OFF
END

 

0
Stef
Telerik team
answered on 12 Jun 2017, 11:47 AM
Hi Jim,

The SqlDataSource Wizard and the component use the selected ADO.NET provider, connection string and command, to create a connection, executed the command and get data in a DataSet. If you use temporary objects in the query, there will be an issue when the query is executed in a mode for obtaining the data schema.

The found by you workaround is also recommended by us - a stored procedure with settings allowing the data schema to be retrieved (How to configure Stored Procedure with Temporary Tables for use with SqlDataSource component).

Regards,
Stef
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Jim
Top achievements
Rank 1
Answers by
Jim
Top achievements
Rank 1
Stef
Telerik team
Share this question
or