Monday, March 26, 2012

how to connect to database in SQL Sever Managment Studio

hi

i have created a .aspx page and a sql database in visual studio ,, my question is how can i connect that database in SQL Server Managment Studio?

Just use SqlConnection to refer to any database on SQL Server as you likeSmileYou can start from here:

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(d=ide).aspx

|||

thanks for the answer ,, but i still need some help.. I i have never used the sql managment studio before...the sql database iam trying to connect to is on my harddrive in the App_data folder in my asp project ,,,, when i start SQL Managamenet studio it wants me to enter the

Server Name:

Server Type:

Authentication

so i typ in

Server Type: Database Engien

Authentication: Windows Authenication

Server Name: mycomputer\SQLEXPRESS this is set by defult

so when i click on connect , it connects to the mycomputer\SQLEXPRESS. am i suppose to find my database among the databases that is in the Object Explorer?

this is my connection string that i found in the web.config file

connectionString

="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient"/>

thank you for your help

by the way ,, the reason why i want to connect my to my database in sql management studio is that i want to enable full text search and indexing

|||

To manage database file in Management Studio, you have to 'register' the database file under the App_Data to the SQL instance. We can use detaching/attaching to do this: firstly in VS2005 right click the database file ->choose Detach; then in Management Studio right click Databases-> choose Attach. There are a lot of materials in SQL2005 Books Online, here is a start link:

http://msdn2.microsoft.com/en-us/library/ms190794.aspx

No comments:

Post a Comment