By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 1,905 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

.Net configuration problem, unable to open Connection

P: n/a
Hi All,
I have a real simple .Net based website (IIS) using C#.
I just kind of got started to develop using .Net I have a
real simple .Net (.aspx extension). In the page load I am
trying to populate the select item from the database.Code
is real simple something like

SqlConnection conn = new SqlConnection(
ConfigurationSettings.AppSettings["sDataConn1"]
);

try
{
conn.Open();

...
conn.Close();
}
catch ( Exception E )
{
Console.WriteLine( E.Message );
}

It gives an exception saying
"SQL server doesnot exist or access denied"
BTW the same application works on another machine, also I
used a simple console application it works just fine on
both the machines, so I am definite its something of a
environment problem with my website. Any pointers will be
highly appreciated.
I am newbee, please get me started
Oslo
Jul 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Are you passing in the user name and password for the database connection string or are you using integrated security? Lots of people had similar problems with integrated security

----- Oslo wrote: ----

Hi All,
I have a real simple .Net based website (IIS) using C#.
I just kind of got started to develop using .Net I have a
real simple .Net (.aspx extension). In the page load I am
trying to populate the select item from the database.Code
is real simple something like

SqlConnection conn = new SqlConnection(
ConfigurationSettings.AppSettings["sDataConn1"
)

try

conn.Open()

..
conn.Close()

catch ( Exception E

Console.WriteLine( E.Message )
It gives an exception saying
"SQL server doesnot exist or access denied
BTW the same application works on another machine, also I
used a simple console application it works just fine on
both the machines, so I am definite its something of a
environment problem with my website. Any pointers will be
highly appreciated.
I am newbee, please get me starte
Osl

Jul 21 '05 #2

P: n/a
I have tried both without luck. Repeat it just doesn't
work on my local machine but on another exactly similar
server it works like a charm. Also my machine where it
doesn't work, I have written a small App writing to
console it works fine !!! BTW the SQL server in on the
network and am using

SqlConnection conn = new SqlConnection(
"Data Source=172.16.X.X; Initial Catalog=dbname; uid=uid;
pwd=pwd" );
-----Original Message-----
Are you passing in the user name and password for the database connection string or are you using integrated
security? Lots of people had similar problems with
integrated security.
----- Oslo wrote: -----

Hi All,
I have a real simple .Net based website (IIS) using C#. I just kind of got started to develop using .Net I have a real simple .Net (.aspx extension). In the page load I am trying to populate the select item from the database.Code is real simple something like

SqlConnection conn = new SqlConnection(
ConfigurationSettings.AppSettings["sDataConn1"]
);

try
{
conn.Open();

...
conn.Close();
}
catch ( Exception E )
{
Console.WriteLine( E.Message );
}

It gives an exception saying
"SQL server doesnot exist or access denied"
BTW the same application works on another machine, also I used a simple console application it works just fine on both the machines, so I am definite its something of a environment problem with my website. Any pointers will be highly appreciated.
I am newbee, please get me started
Oslo

.

Jul 21 '05 #3

P: n/a
Oslo
In your connection string, you should replace uid with User ID

Tu-Thac

----- Oslo wrote: ----

I have tried both without luck. Repeat it just doesn't
work on my local machine but on another exactly similar
server it works like a charm. Also my machine where it
doesn't work, I have written a small App writing to
console it works fine !!! BTW the SQL server in on the
network and am using

SqlConnection conn = new SqlConnection(
"Data Source=172.16.X.X; Initial Catalog=dbname; uid=uid;
pwd=pwd" )
-----Original Message----
Are you passing in the user name and password for the database connection string or are you using integrated
security? Lots of people had similar problems with
integrated security
----- Oslo wrote: ----
Hi All,

I have a real simple .Net based website (IIS)

using C#. I just kind of got started to develop using .Net I have a real simple .Net (.aspx extension). In the page load I am trying to populate the select item from the database.Code is real simple something like
SqlConnection conn = new SqlConnection( ConfigurationSettings.AppSettings["sDataConn1"
)
try


conn.Open()
..

conn.Close()

catch ( Exception E

Console.WriteLine( E.Message )
It gives an exception saying

"SQL server doesnot exist or access denied
BTW the same application works on another machine,

also I used a simple console application it works just fine on both the machines, so I am definite its something of a environment problem with my website. Any pointers will be highly appreciated.
I am newbee, please get me starte
Osl

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.