各位C#里面app.config连接数据库的字符串怎么写
3个回答
2015-02-06 · 知道合伙人数码行家
关注
展开全部
在app.config里面写上下面的代码:
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="StudentSystem.Properties.Settings.SchoolConnectionString"
connectionString="Data Source=PC-200908251645;Initial Catalog=School;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
然后访问时写上:
SqlConnection con =
new SqlConnection("server=PC-200908251645;database=school;Integrated Security=True")
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="StudentSystem.Properties.Settings.SchoolConnectionString"
connectionString="Data Source=PC-200908251645;Initial Catalog=School;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
然后访问时写上:
SqlConnection con =
new SqlConnection("server=PC-200908251645;database=school;Integrated Security=True")
展开全部
在app.config里面写上下面的代码:
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="StudentSystem.Properties.Settings.SchoolConnectionString"
connectionString="Data Source=PC-200908251645;Initial Catalog=School;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
然后访问时写上:
SqlConnection con =
new SqlConnection("server=PC-200908251645;database=school;Integrated Security=True")
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="StudentSystem.Properties.Settings.SchoolConnectionString"
connectionString="Data Source=PC-200908251645;Initial Catalog=School;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
然后访问时写上:
SqlConnection con =
new SqlConnection("server=PC-200908251645;database=school;Integrated Security=True")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
c# 连接字符串代码实例提供
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询