.Net configuration problem, unable to open Connection

  • Thread starter Thread starter Oslo
  • Start date Start date
O

Oslo

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
 
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
 
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



.
 
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"
)

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
 
Back
Top