Last post Oct 02, 2016 05:53 AM by Yohann Lu
Sep 30, 2016 01:28 PM|shriramk|LINK
I have the following development environment for ASP.Net WebPage
VS 2015 Professional Version, using .Net Framework 4.0
MySQL Server 5.6,
MySQL .Net Connector 6.9.5
MySQL for Visual Studio 2.0.2
I am able to connect to the MySQL database server from Visual Studio Server Explorer.
I am trying to create a SQL DataSource for MySQL Database.
When I go through the configure data source wizard, it works fine by populating the tables and columns for each table in "Configure Select Statement form", but then it fails when I try to run the test query in the wizard. It gives errors
"Could Not Create Connection Object reference not set to an instance of an object."
After that I click OK and Finish and the try to refresh schema on the SQLDataSource object in the design view it gives the error
"Unable to retrieve schema. Ensure that the ConnectionString and SelectCommand properties are valid. Object reference not set to an instance of an object."
Following code is generated in the aspx file.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:gdsvalueConnectionString %>"
ProviderName="<%$ ConnectionStrings:gdsvalueConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [sites]"></asp:SqlDataSource>
And the connection string looks like this in web.config
<add name="gdsvalueConnectionString" connectionString="server=localhost;user id=root;password=admin;persistsecurityinfo=True;database=gdsvalue"
You can see the error image at this link : https://drive.google.com/open?id=0B8Arhho9L0FwbTRPOGFfWjBydW8
Please help me figure out what is missing in my development environment.
Oct 02, 2016 05:53 AM|Yohann Lu|LINK
As far as I know, the SqlDataSource control works with the .NET Framework Data Provider for SQL Server, but SqlDataSource is not Microsoft SQL Server-specific. You can connect the SqlDataSource control with any database product for which there is a managed
You can refer the following article described the steps involved in creating an ASP.NET web page that displays data from a MySQL Server.
Displaying MySQL data on an ASP.NET Web Page: