469,964 Members | 1,770 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

confused with connections in asp.net

232 100+
i m from asp background
i m very new to asp.net
n i m confused with connections in asp.net
i have a project in asp.net for practice
its web.config file which i think is a connection file has connection with sql express
what should i do to connect it with sql server 2005
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?xml version="1.0"?>
  3. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  4. <appSettings/>
  5. <connectionStrings>
  6. <add name="ConnectionString" connectionString="Data Source=localhost\SQLExpress;Initial Catalog=asd;Integrated Security=True" providerName="System.Data.SqlClient"/>
  7. </connectionStrings>
  8. <system.web>
  9. <compilation debug="true"/>
  10. <authentication mode="Windows"/>
  11.  
  12.  
  13. </system.web>
  14.  
  15. </configuration>
  16.  
Feb 1 '09 #1
8 1274
Bassem
344 100+
Simple connectionString
<add name="dbConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\dbName.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
Now put your database in the data directroy.
I hope it will help!
Regards,
Bassem
Feb 1 '09 #2
kkshansid
232 100+
but i hav to connect it with sql server 2000 or 2005 which hav username and password and server authentication mode.your connection is still with sql express
Feb 2 '09 #3
kunal pawar
297 100+
See "Data Source" is your sever name. Like tt\SQLExpress or may be TT its depeands when you install Sql Server 2005.

Or you can refer connectionstrings.com
Feb 2 '09 #4
Hi kkshansid,
You can have the connectionstring in the web.config file like this:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <!-- Connection strings-->
  3. <connectionStrings>
  4. <remove name="MyConnectionString"></remove>
  5. <add name="MyConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyDB;User ID=mysqlusername;Password=mypassword;pooling=false" providerName="System.Data.SqlClient"/>
  6. </connectionStrings>
  7.  
Hope this helps.
Feb 2 '09 #5
kkshansid
232 100+
what about authentication mode windows mode dont take user id and password
Feb 2 '09 #6
You can just use Integrated Security=true in the connection string if you are going to use Windows Authentication mode.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <!-- Connection strings-->
  3. <connectionStrings>
  4. <remove name="MyConnectionString"></remove>
  5. <add name="MyConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=true;pooling=false" providerName="System.Data.SqlClient"/>
  6. </connectionStrings>
  7.  
Waiting you feedback. Thanks.
Feb 2 '09 #7
kkshansid
232 100+
sql server 2005 details
server name=kkshansid
user id=sa
password=
it is sql server 2005 not sql express
what should be authentication mode?
Feb 2 '09 #8
Now perhaps it is my turn to be confused! It seems you have some different requirement. I hope this link provides you much guidance.

http://www.connectionstrings.com/sql-server-2005

Hope you find the right connection string here. Thank you.
Feb 2 '09 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Mudge | last post: by
4 posts views Thread by Angelos | last post: by
1 post views Thread by C Sharp beginner | last post: by
2 posts views Thread by Bob | last post: by
17 posts views Thread by Peter Proost | last post: by
15 posts views Thread by cedgington | last post: by
5 posts views Thread by Usman Jamil | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.