SQL Server connection with ASP.NET and C#

Morpheus

Well-known member
Joined
Jan 18, 2002
Messages
62
Hi

Im trying to connect to SQL Server with ASP.NET using this code:


<c>
myConnectionString = "Initial Catalog=kundhantering;Data Source=localhost;Integrated Security=SSPI";
SqlConnection myConnection = new SqlConnection(myConnectionString);
myConnection.Open();
</c>

I get an error that looks something like this:
"Login failed for user <myComputerName\ASPNET"
 
ASPNET user on your machine doesnt have sufficient access rights to log onto SQL Server.

You can either make ASPNET user an administrator (wouldnt do that) add ASPNET to a group, which does have rights to log into SQL Server. Or alternatively add ASPNET to user list in SQL Server (probably best source SQL Server Books Online)
 

Similar threads

D
Replies
0
Views
775
DexterCamarillo
D
C
Replies
0
Views
115
Carlo Goretti
C
C
Replies
0
Views
89
CSharp Enthusiast
C
Back
Top