all groups > sql server connect > march 2006 >
You're in the

sql server connect

group:

C# web app connection to SQL 2000


RE: C# web app connection to SQL 2000 Linchi Shea
3/19/2006 8:44:33 AM
sql server connect:
You are probably using the key word Integrated Security=SSPI or
trusted_connection=yes in your connection string and your Windows credential
(i.e. that of the login that runs the program) has not been granted access to
the SQL Server instance.

I'd first change Integrated Security=SSPI to user=myUser;pwd=myPassword, and
verify that there is no problem with connectivity itself (and there shouldn't
be any per your error message). Then, grant the Windows login access to the
SQL Server instance, and now you can use Integrated Security=SSPI.

Linchi


[quoted text, click to view]
C# web app connection to SQL 2000 Antonio
3/19/2006 9:50:35 AM
Hello, everyone,

I am trying to connect to a SQL server db with a C# app and when I debug I
get:

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
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
'(null)'. Reason: Not associated with a trusted SQL Server connection.

Source Error:


Line 27: if (!Page.IsPostBack)
Line 28: {
Line 29: sqlDataAdapter1.Fill(dsStudents1);
Line 30: DataGrid1.DataBind();
Line 31: }


Can somebody give me any suggestions?

Thanks,


Antonio

Re: C# web app connection to SQL 2000 Shimon Sim
3/19/2006 2:48:45 PM
You need to grant access to ASPNET user to your database. That is the
account that web application use.

[quoted text, click to view]

Re: C# web app connection to SQL 2000 Antonio
3/22/2006 10:39:29 AM
The ASPNET user is setup in the database (the ASPNET user in the server, not
my machine) with access to the specific database, as owner.

[quoted text, click to view]
Re: C# web app connection to SQL 2000 Shimon Sim
3/22/2006 8:35:36 PM
What is your connection string?
It is strange that user is '(null)'.

[quoted text, click to view]

Re: C# web app connection to SQL 2000 Jens
3/23/2006 12:26:37 AM
Didi you grant the appropiate rights to the service account which
starts the worker process (on *your* computer) on the SQL Server ?

Domain\ServiceAccount (Your Computer) -- > has to be prviledged on the
SQL Server

Make sure that you didn=B4t accept anonymous authentication on your
webserver.

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---
AddThis Social Bookmark Button