在Web.Config中创建连接字符串:
1、asp.net连接Access数据库代码:
2、asp.net连接mssql数据库代码:
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\grade.mdf;Integrated Security=True;User Instance=True" providerName="System.Da ta.SqlClient" />
<add name="sampleConnectionString" connectionString ="server=.\SQLEXPRESS;database=sample;uid=sa;pwd=123456;" providerName ="System.Data.SqlClient"/>
<add name ="testConnectionString" connectionString ="Data Source=.\SQLEXPRESS;Initial Catalog=sample;Integrated Security=True;Persist Security Info=True;User ID=sa;Password=123456" providerName ="System.Da ta.SqlClient"/>
本文章由技术小学生博客整理,转载请注明出处:https://blog.tag.gg/showinfo-12-35842-0.html<connectionStrings>
<add name="SqlDB" connectionString="Data Source=sql.123.vhostgo.com;Initial Catalog=hmesepims;Integrated Security=False;uid=hmesepims;pwd=ly001112" providerName="System.Data.SqlClient" />
</connectionStrings>
文章评论 本文章有个评论