Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 20, 2013 03:56 PM by juanfelipecaro77
Dec 30, 2010 02:49 AM|LINK
I have installed sql 2008 R2 and also sql management studio. I am able to connect to the db through windows and sql authentication. I have then installed VS2010 express edition. When I goto Database explorer, right click on data connection, I can see only
add connection which is not grayed out. From here no matter what I do, I cannot connect to the db. Infact I get 3 optins 1. Acess database file, 2. sql server compact 3.5 , 3. sql server database file
Dec 30, 2010 04:40 AM|LINK
To connect to your Microsoft SQL Server database with Visual Studio .NET, follow the steps listed below.
1) Open Server Explorer (View -> Server Explorer)
2) The Server Explorer should show up on the left hand side of the IDE
3) Right click on "Data Connections" and select "Add Connection".
4) Enter the Server Name in the first textbox (do not use the drop down box). MS SQL Server name can be found in the database manager section of the control panel.
5) Check "Use a specific user name and password:"
6) Enter your SQL username & password
7) Select your database from the dropdown list.
8) Click "Ok"
9) Once connected, you should see a new entry in the Data Connections Section
Dec 30, 2010 05:48 AM|LINK
I don't have server explorer in VS2010 express. I have database explorer. I have followed steps 1 to 3. But in the 4rth step. I don't get any text box. I get a dialog box which contains a Datasource listbox, Data provider combo box. The datasource listbox
1. Acess database file, 2. sql server compact 3.5 , 3. sql server database file
while the combobox changes according to the content of the listbox
Dec 30, 2010 06:04 AM|LINK
So you need to select Data provider as sql server and put the sql instance as:
Dec 30, 2010 08:21 AM|LINK
I selected sql server database file in the list box and then in the combo box .net framework data provider for sql server get's selected. I click on continue and I get a window which has
1. edit box with a browse button called as "Database filename (new or existing)"
2. A group box "Log on to Server" with two radio buttons "Window Authentication" , "Sql authentication"
3. Advanced button
4. Test connection button
I then typed a name into the database file edit box. As windows authentication was selected, I clicked on test connection and I got
"This connection cannot be tested because the specified database file does not exist."
Dec 30, 2010 08:34 AM|LINK
Check windows authentication then select database from dropdownlist and click on Test connection.
if it succeed then OK.
Dec 30, 2010 09:00 AM|LINK
without typing anything in the edit box with a browse button called as "Database filename (new or existing)" if I just click on test connection then I get a messsage that "No database file was selected". So I browsed to the mdf file which contains the data
under the programs file/mssql server/.../data folder and selected the mdf file. I got a message that I don't have the permsssion to open this file. contact the file ownder or an administrator tobtain permission
Dec 30, 2010 09:13 AM|LINK
Dec 30, 2010 10:05 AM|LINK
I don't get what those links were trying to tell . This is what I have done. I have right clicked on C# and selected run as administrator. Then I was able to select the file from the data directory folder and open the connection and the database was visible
in the Database Explorer. As I was trying to work on Linq on SQl, I added a linq to sql class and I clicked on the dbml file. Onto this I dragged and dropped the table from the database explorer. I got a message,
The connection you selected uses a local data file that is not in the current project. Would you like to copy the file to your project and modify the connection?If you copy the data file to your project, it will be copied to the project's output directory each
time you run the application. Press F1 for information on controlling this behavior.
I clicked on Yes.
Now I got
Connections to SQL Server database files (.mdf) require SQL Server 2005 Express or SQL Server 2008 Express to be installed and running on the local computer. The current version of SQL Server Express can be downloaded at the following URL: http://go.microsoft.com/fwlink/?LinkId=125883
I went to link mentioned above and I saw that I have the same thing installed.
I clicked on ok again. The table details were added on the screen of the dbml file. But why the error above? Infact I got the same error when I tried to directly add a "Service based database" as a new item from the project. I will now try to see if I can perform
linq on sql. But I hope somebody can help me with the problem above. In fact I am having the same error message as above on another system which has VS2008 Pro and SQL2008 R2 express.
Jan 05, 2011 07:05 AM|LINK
Please post the your connection string which in web.config here for us checking, I doubt maybe there is any error in it.