Connecting to data base
-
hello, i have this coonectio string in my web.config.
<connectionStrings> <add name="ShoppingConnectionString2" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Inetpub\wwwroot\myonlineshopping01\App_Data\MyOnlineShopping.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" />
and my page.aspx.cs is this:<code>SqlConnection MyConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShoppingConnectionString2"].ConnectionString);</code>
; but i could not connect to database, is this codes result of that i can't connect. thank you,Hoda
-
hello, i have this coonectio string in my web.config.
<connectionStrings> <add name="ShoppingConnectionString2" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Inetpub\wwwroot\myonlineshopping01\App_Data\MyOnlineShopping.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" />
and my page.aspx.cs is this:<code>SqlConnection MyConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShoppingConnectionString2"].ConnectionString);</code>
; but i could not connect to database, is this codes result of that i can't connect. thank you,Hoda
Saba02 wrote:
but i could not connect to database,
*sigh* I'm going to ask some obvious questions that we shouldn't really need to ask. I mean really, do you go to your doctor and say "I'm ill! is my diet the problem?" with out giving any other information? So, what was the error message? If there was no error message what did it do instead of connecting to the datbase? Have you checked that the connection string is actually correct for the database?
Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) - (part 3) My website | Blog
-
hello, i have this coonectio string in my web.config.
<connectionStrings> <add name="ShoppingConnectionString2" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Inetpub\wwwroot\myonlineshopping01\App_Data\MyOnlineShopping.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" />
and my page.aspx.cs is this:<code>SqlConnection MyConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShoppingConnectionString2"].ConnectionString);</code>
; but i could not connect to database, is this codes result of that i can't connect. thank you,Hoda
Saba02 wrote:
i can't connect
You ought to be more clear in what you are encountering (the exact error message which you are getting) while attempting to connect to the data source.
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson