Problem with database (Login failed for user 'X')

G

Guest

Hi; when I use sql server connection or ole connection for working with
database I receive the login failed for user 'any user that I work'.I've been
granted ASPNET user in sql.
 
J

Jacek Stawicki

U¿ytkownik "Ramtin said:
Hi; when I use sql server connection or ole connection for working with
database I receive the login failed for user 'any user that I work'.I've
been
granted ASPNET user in sql.

Give us more data. Some line with error description, line with code etc.
There are many possible reasons.
 
G

Guest

Hi;
Thanks for your attention.I have not any problem with windows
application.the exact message that I recieve in web application is this:
(some description is below)
Server Error in '/Temp' Application.
--------------------------------------------------------------------------------

Login failed for user 'sa'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'sa'.

Source Error:


Line 30: if(!IsPostBack)
Line 31: {
Line 32: sqlConnection1.Open();
Line 33: sqlDataAdapter1.Fill(dataSet11);
Line 34: DataGrid1.DataBind();


Source File: c:\inetpub\wwwroot\temp\webform1.aspx.cs Line: 32

Stack Trace:


[SqlException: Login failed for user 'sa'.]
System.Data.SqlClient.ConnectionPool.CreateConnection()
System.Data.SqlClient.ConnectionPool.UserCreateRequest()
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
Temp.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\temp\webform1.aspx.cs:32
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

This occurs when I use local sql server.when I use other sql server on the
network I give "server is not exist" message.I follow this steps:
1) I create a sqlconnection 2)I set a sql statement in a data adapter
3)generate a data set 3)in page load event I add above codes.
 
C

cannontrodder

You are trying to connect using SA as the user. Try to connect using
sql management studio or query analyser using sql authentication.

Note: it's not a good idea AT ALL to connect using the sa account.
ASP.NET applications run under a particular username (in my case
ASPNET). It's best to use windows authentication and grant access to
the unprivileged account that asp.net applications run under.

Hi;
Thanks for your attention.I have not any problem with windows
application.the exact message that I recieve in web application is this:
(some description is below)
Server Error in '/Temp' Application.
--------------------------------------------------------------------------------

Login failed for user 'sa'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'sa'.

Source Error:


Line 30: if(!IsPostBack)
Line 31: {
Line 32: sqlConnection1.Open();
Line 33: sqlDataAdapter1.Fill(dataSet11);
Line 34: DataGrid1.DataBind();


Source File: c:\inetpub\wwwroot\temp\webform1.aspx.cs Line: 32

Stack Trace:


[SqlException: Login failed for user 'sa'.]
System.Data.SqlClient.ConnectionPool.CreateConnection()
System.Data.SqlClient.ConnectionPool.UserCreateRequest()
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
Temp.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\temp\webform1.aspx.cs:32
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

This occurs when I use local sql server.when I use other sql server on the
network I give "server is not exist" message.I follow this steps:
1) I create a sqlconnection 2)I set a sql statement in a data adapter
3)generate a data set 3)in page load event I add above codes.


Jacek Stawicki said:
Give us more data. Some line with error description, line with code etc.
There are many possible reasons.
 
G

Guest

Hi; The sa user is for example I'd been using so many different users.But
finally I use the other post and solve my problem.I must add UID and PWD in
connection string

Thanks for your attention
cannontrodder said:
You are trying to connect using SA as the user. Try to connect using
sql management studio or query analyser using sql authentication.

Note: it's not a good idea AT ALL to connect using the sa account.
ASP.NET applications run under a particular username (in my case
ASPNET). It's best to use windows authentication and grant access to
the unprivileged account that asp.net applications run under.

Hi;
Thanks for your attention.I have not any problem with windows
application.the exact message that I recieve in web application is this:
(some description is below)
Server Error in '/Temp' Application.
--------------------------------------------------------------------------------

Login failed for user 'sa'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'sa'.

Source Error:


Line 30: if(!IsPostBack)
Line 31: {
Line 32: sqlConnection1.Open();
Line 33: sqlDataAdapter1.Fill(dataSet11);
Line 34: DataGrid1.DataBind();


Source File: c:\inetpub\wwwroot\temp\webform1.aspx.cs Line: 32

Stack Trace:


[SqlException: Login failed for user 'sa'.]
System.Data.SqlClient.ConnectionPool.CreateConnection()
System.Data.SqlClient.ConnectionPool.UserCreateRequest()
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
Temp.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\temp\webform1.aspx.cs:32
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

This occurs when I use local sql server.when I use other sql server on the
network I give "server is not exist" message.I follow this steps:
1) I create a sqlconnection 2)I set a sql statement in a data adapter
3)generate a data set 3)in page load event I add above codes.


Jacek Stawicki said:
U¿ytkownik "Ramtin" <[email protected]> napisa³ w wiadomo¶ci
Hi; when I use sql server connection or ole connection for working with
database I receive the login failed for user 'any user that I work'.I've
been
granted ASPNET user in sql.

Give us more data. Some line with error description, line with code etc.
There are many possible reasons.
 
J

Jacek Stawicki

U¿ytkownik "Ramtin said:
Hi; The sa user is for example I'd been using so many different users.But
finally I use the other post and solve my problem.I must add UID and PWD
in
connection string


What is the connection string?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top