Visual Studio 2015:无法检索架构。确保ConnectionString和SelectCommand属性有效。 [英] Visual Studio 2015 : Unable to retrieve schema. Ensure that the ConnectionString and SelectCommand properties are valid.

查看:240
本文介绍了Visual Studio 2015:无法检索架构。确保ConnectionString和SelectCommand属性有效。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有ASP.Net WebPage的以下开发环境



VS 2015专业版,使用.Net Framework 4.0



MySQL服务器5.6,



MySQL .Net连接器6.9.5



MySQL for Visual Studio 2.0.2



我可以从Visual Studio Server Explorer连接到MySQL数据库服务器。



我正在尝试为MySQL数据库创建一个SQL数据源。

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."

之后我点击确定并完成并尝试在设计视图中刷新SQLDataSource对象上的模式,它会给出错误

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

"无法检索模式。确保ConnectionString和SelectCommand属性有效。 对象引用未设置为对象的实例。"

"Unable to retrieve schema. Ensure that the ConnectionString and SelectCommand properties are valid. Object reference not set to an instance of an object."

以下代码在aspx文件。

Following code is generated in the aspx file.

< asp:SqlDataSource ID =" SqlDataSource1" RUNAT = QUOT;服务器" ConnectionString ="<%$ ConnectionStrings:gdsvalueConnectionString%>" 

ProviderName ="<%$ ConnectionStrings:gdsvalueConnectionString.ProviderName%>" SelectCommand =" SELECT * FROM [sites]"> < / asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:gdsvalueConnectionString %>" 
ProviderName="<%$ ConnectionStrings:gdsvalueConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [sites]"></asp:SqlDataSource>

连接字符串在web.config中如下所示

And the connection string looks like this in web.config




请帮我弄清楚我的开发环境中缺少什么。

Please help me figure out what is missing in my development environment.

Shriram Karpur

Shriram Karpur

推荐答案

嗨Shriram Kar pur,

根据你的描述,你使用SQLDataSource控件,这是asp.net数据控件,我建议你可以发布你的问题asp.net论坛支持。

According to your description, you use SQLDataSource control, which is asp.net data control, I would suggest you could post your issue on asp.net forum for support.

http: //forums.asp.net/24.aspx/1?Web+Forms+Data+Controls

此外,以下链接提供了一步一步的操作使用MySQL和ASP.NET的指南供参考。

In addition, the follow link provide a Step-by-Step Guide To Using MySQL with ASP.NET for your reference.

http://www.codeguru.com/csharp/.net/net_data/article.php/c19637/A- StepbyStep-Guide-To-Using-MySQL-with-ASPNET - Part-3.htm

注意:此响应包含对第三方万维网站点的引用。 Microsoft提供此信息是为了方便您。 

Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. 

Microsoft不控制这些网站并且未测试任何网站在这些网站上找到的软件或信息;因此,Microsoft不能对任何
软件的质量,安全性或适用性做出任何陈述。

Microsoft does not control these sites and has not tested any software or information found on these sites;Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

使用互联网上的任何软件都存在固有的危险,微软提醒您在从互联网上检索任何软件之前确保您完全了解风险。

There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

祝你好运

Cole Wu


这篇关于Visual Studio 2015:无法检索架构。确保ConnectionString和SelectCommand属性有效。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆