如何在Asp.Net中创建一个SQL连接字符串 [英] How to make a Sql Connection String in Asp.Net

查看:58
本文介绍了如何在Asp.Net中创建一个SQL连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有数据库indexdb.mdf

我想使用Sql ConnectionString连接到它,并想在Open as ...上检查其状态.

i have database indexdb.mdf

i want to connect to it using Sql ConnectionString and want to check its status on Open as...

SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS; AttachDbFilename=D:\PROJECTS\Project\App_Data\indexdb.mdf;
Integrated Security=True;
User Instance=True");

con.Open();



不工作状态即将关闭.



Not working. Status coming to be closed. how to do it??

推荐答案

http ://msdn.microsoft.com/zh-CN/library/bf7sd233.aspx [ ^ ]
http://pietschsoft.com/post/2005/12/28/ASPNET-20-How-to-get-a-specific-ConnectionString-from-the-WebConfig-by-name.aspx [ http://www.connectionstrings.com/sql-server-2005 [ http://stackoverflow.com/questions/173209/how-do-i-connect-to-an-mdf-microsoft-sql-server-database-file-in-a-simple-web [
http://msdn.microsoft.com/en-us/library/bf7sd233.aspx[^]
http://pietschsoft.com/post/2005/12/28/ASPNET-20-How-to-get-a-specific-ConnectionString-from-the-WebConfig-by-name.aspx[^]

http://www.connectionstrings.com/sql-server-2005[^]

http://stackoverflow.com/questions/173209/how-do-i-connect-to-an-mdf-microsoft-sql-server-database-file-in-a-simple-web[^]


Above links may help you to understand.


您的数据库是否已附加?或者您想使用代码将其附加.

如果要附加数据库,请
单击此处 [ ^ ]
Is your database already Attached ? or u want to attached it using code.

If you want to attach your database then Click here[^]


这篇关于如何在Asp.Net中创建一个SQL连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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