Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 17th, 2006, 03:00 PM
Authorized User
Join Date: Jun 2004
Location: , , .
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default System.Data.SqlClient.SqlException: Login failed f

Hi all,

Can someone explain it to me why I am getting the following error when I try to connect SQL server express with .NET 2.0?

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 ''. The user is not associated with a trusted SQL Server connection.

Here is my code and i am using windows authentication:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>


    Dim connAkaki As SqlConnection
    Dim cmdSelectAuthers As SqlCommand
    Dim dtrAuthers As SqlDataReader

    connAkaki = New SqlConnection("Server=.\SQLEXPRESS;database=akaki" )


    cmdSelectAuthers = New SqlCommand("select Firstname from UserTableTest", connAkaki)
    dtrAuthers= cmdSelectAuthers.ExecuteReader()

    While dtrAuthers.Read()

    End While



Reply With Quote
  #2 (permalink)  
Old May 17th, 2006, 03:35 PM
SQLScott's Avatar
Wrox Author
Join Date: Dec 2004
Location: Wellington, FL , USA.
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts

You are not passing a username and password. Even SQLExpress needs a username and password to connect. Your connection line should looks somehting like this:

connAkaki = New SqlConnection("Server=.\SQLEXPRESS;database=akaki; UID=username;PWD=password")

Reply With Quote
  #3 (permalink)  
Old May 18th, 2006, 04:10 AM
Authorized User
Join Date: Jun 2004
Location: , , .
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts

hI SQLScott;
Thank you for your reply. But I am using Windows Authentication to connect to the SQL server. Accessing my web application through ISS.
Both Machine-Name\ASPNET, and Network sevices have permission to connect to the database .

I am new to SQL server. I just migrated from access to SQL server

Reply With Quote
  #4 (permalink)  
Old May 18th, 2006, 08:18 AM
Friend of Wrox
Join Date: Dec 2005
Location: , AZ, .
Posts: 146
Thanks: 0
Thanked 1 Time in 1 Post

You want to look into Permitting your Web Server to impersonate your users.
Use Kerberos

David Lundell
Principal Consultant and Trainer
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing System.Data.SQLClient dll mike_abc VB.NET 2 June 3rd, 2011 10:18 PM
System.Data.SqlClient.SqlDataReader - URGENT wk ASP.NET 2.0 Basics 8 September 27th, 2006 05:00 AM
'SYSTEM.DATA.SQLCLIENT.SQLEXCEPTION' soorsha General .NET 0 September 23rd, 2006 11:59 PM
System.Data.SqlClient.SqlException kbarsi Beginning VB 6 2 August 13th, 2005 09:39 PM
Data.SqlClient.SqlException: Login failed csun ASP.NET 1.0 and 1.1 Basics 3 October 15th, 2004 03:01 PM

All times are GMT -4. The time now is 01:00 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.