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

Unable to Create a SQLDataSource

1 Answer 240 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Probanx
Top achievements
Rank 1
Probanx asked on 05 Jul 2018, 08:24 AM

No matter what I do I am unable to create a SQLDataSource.

I am using the latest Telerik Reporting Framework.

It creates a connection string and the string it creates is correct and it adds it to the App.Config.

It says connection succeeded when I test the connection.

However it says:

Unable to create SQLDataSource check your connection string.

Now, I realize that most development companies have a default message to show customers when the real error was too hard to actually program because most developers fear custom exceptions.

But in this case, the wizard just errors out and creates the Setting correctly and then doesn't create the sql data source.

Now here's how to reproduce it because I know if I don't tell you how to reproduce it you will take many days to get back to me.

1) Install Telerik Reporting Trial by itself no other features via the MSI.

2) Next Create a Standard .NET Class Library in .NET 4.7.2

3) Create The project name as NameOfTheApp.Reports

4) Create a folder called Reports

5) Create an empty app.config in the class library at the root of the class library project

6) Right click the Reports folder and Add New Item

7) Select Telerik Report Wizard
8) Select Table Template

9) From the Project or Current Data Sources Create A New SQLDataSource With Type Microsoft SQL Server Connection Type And Use 

Windows Or Sql Username/Password Authentication, Select A Database With Stored Procedures. 

10) Select Stored Procedure With A Mix Of DateTime and Other Parameters

11) Pass in 2018-07-05 or a date into the date field which would work in an actual query

12) No rows will return no matter what you do

13) Click Finish, and the result will be that there will be an error message complaining about the connection string being incorrect.

14) Even though the connection string is correct and Test Connection works, the datasource is not created, the report is not created and the String is added to the app.config and the settings. 

What is the real error?

1 Answer, 1 is accepted

Sort by
0
Ivan Hristov
Telerik team
answered on 09 Jul 2018, 12:09 PM
Hi,

Thank you for the detailed explanation. We were able to reproduce the described behavior under certain circumstances, which are related to the way Visual Studio refreshes the currently opened files.

When finishing the Configure SQL Data Source wizard, it saves the current connection string to Settings.settings and app.config files and passes the workflow to the Table Wizard, which tries to read the connection string from the application configuration file. However, if that file is currently opened in a tab in VS, it stays in a "modified" state and is not really saved on the disk. That's why the Table Wizard cannot read it and shows the error message "Unable to establish a connection to the database".

In this case the options are to either close the Table Wizard, save all files and start it again, or just make sure the app.config is not opened when the Table Wizard is started. Although it is not specifically mentioned in the scenario, I believe that when adding the app.config on step 5, it is left opened in a tab in VS.

I shot a small movie clip that demonstrates the behavior of the wizards in this scenario. In the first part I add an app.config file and leave it there on purpose. You can see at 0:52 how its tab is decorated with a star which means its state is changed to dirty/modified and not yet saved. The second part of the clip shows how the wizard works with a closed app.config and successfully produces a working report.
I used a stored procedure which requires a datetime as input parameter, but was unable to reproduce the problem you're describing at step 12. The parameter is parsed correctly and the result is a few rows returned from the AdventureWorks database.
The movie clip can be seen here: https://www.screencast.com/t/ytlTeL7tbf. It has no sound and requires Adobe Flash to run. I hope you will find it useful.

If you have further questions, please do not hesitate to ask.

Regards,
Ivan Hristov
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
Probanx
Top achievements
Rank 1
Answers by
Ivan Hristov
Telerik team
Share this question
or