Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ASP.Net中设置数据库_Asp.net_Sql_Data Binding - Fatal编程技术网

如何在ASP.Net中设置数据库

如何在ASP.Net中设置数据库,asp.net,sql,data-binding,Asp.net,Sql,Data Binding,我在xmachina\sqlexpress位置有一个名为News的数据库,News有一个表NewsTable。如何让ASP查看新闻数据库?它是SelectCommand的一部分吗?还是webconfig变量 现在我得到一个[SqlException(0x80131904):无效的对象名“NewsTable”。] web.config <add name="NewsTableConnectionString" connectionString="Data Source=XMACHINA\SQ

我在xmachina\sqlexpress位置有一个名为News的数据库,News有一个表NewsTable。如何让ASP查看新闻数据库?它是SelectCommand的一部分吗?还是webconfig变量

现在我得到一个[SqlException(0x80131904):无效的对象名“NewsTable”。]

web.config

<add name="NewsTableConnectionString" connectionString="Data Source=XMACHINA\SQLEXPRESS;Integrated Security=True" providerName="System.Data.SqlClient" />

Default.aspx

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
   ConnectionString="<%$ ConnectionStrings:NewsTableConnectionString %>"
       ProviderName="<%$ ConnectionStrings:NewsTableConnectionString.ProviderName %>" 
       SelectCommand="SELECT [NewsHeadline] FROM [NewsTable]">
</asp:SqlDataSource>

在web.config中的连接字符串设置中使用此选项

<add name="NewsTableConnectionString" connectionString="Data Source=XMACHINA\SQLEXPRESS;Integrated Security=True" providerName="System.Data.SqlClient" />
数据库=新闻


有关详细信息,请访问以下网站:

在web.config中的连接字符串设置中使用此选项

<add name="NewsTableConnectionString" connectionString="Data Source=XMACHINA\SQLEXPRESS;Integrated Security=True" providerName="System.Data.SqlClient" />
数据库=新闻

有关详细信息,请参见以下站点:

我需要此“初始目录”属性

<add name="NewsTableConnectionString" connectionString="Data Source=XMACHINA\SQLEXPRESS;Integrated Security=True;Initial Catalog=News" providerName="System.Data.SqlClient" />

我需要这个“初始目录”属性

<add name="NewsTableConnectionString" connectionString="Data Source=XMACHINA\SQLEXPRESS;Integrated Security=True;Initial Catalog=News" providerName="System.Data.SqlClient" />