Posted: 11/7/2011
Hello
I have created a database Example in sql server 2008now I want to connect this DB in Visual studio 2008
so I had followed the following steps :- 1. On server explorer right click on Data Connections select Add Connection 2. choose Data Sourse as Microsoft SQL Server & Data Provider as .Net framework data provider for sql 3. Then add server name example: myComputerName\SQLEXPRESS 4. when I choose Select or enter database name option at this point it's not showing me Example database but showing only system database names (master,model,msdb,tempdb) I am using windows authencationwhy it is not showing Example database name into dropdownlisthow to resolve this problem please help me
Posted: 1/9/2012
Hi,
You can use write this code in web.config file .
<connectionString>
<add name="conn" connectionstring="server=your servername;database=database name;uid=your username;pwd=your password" Provider="System.Data.SqlClient" />
</connection string>
Regards
Websoftcreation,Jaipur
Posted: 1/10/2012
The easiest way to determine the actual connection string is to use the SqlDataSource. configure the control by following the wizard and point the database location that you want to use. You can then copy the connection string generated in the SqlDataSource and use it as the connection string. You can even bind your SqlDataSource directly to your dropdownlist if you wish to.
Also you may want to take a look at this link for more details about connecting your database from Visual Studio.
http://msdn.microsoft.com/en-us/library/ms171886%28v=vs.80%29.aspx