Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

 Hmmm....

I have been developing a site on my local machine and it all works there. When I push it to the web-server it does not. I have used connection strings in my web.config file that look like this (the names have been changed to protect the innocent.. or me...)

 <add name="TDemoSiteConnectionString" connectionString="Data Source=192.168.8.37;Initial Catalog=TDemoSite;Persist Security Info=True;User ID=TDemo;Password=fred" providerName="System.Data.SqlClient" />

When I call a table adapter I get the error 'login failed for user null'. When I call one of my stored procedures using a QueriesTableAdapter, it works fine.

They use the same connection... It is acting like there is no connection for the tableadapter, although I specified one when setting up the XSD. I am suspicious that somehow it still is trying to use integrated security for the tableAdapters. How can I programatically tell the adapter when I call it to use the connection called TDemoSiteConnectionString.

The code that fails on the webserver (but works locally) looks like this:

 

Dim dt As New TData.prSelectCampaignMediaTypesDataTable

        '*** Get the data
        Try
            Dim td As New TDataTableAdapters.prSelectCampaignMediaTypesTableAdapter
            'td.Connection() = TDemoSiteConnectionString
            td.Fill(dt)

 ******

As you can see I have been tinkering, unsuccessfully.

Thanks.


Ask One/Answer One.
0
jmurdock
9/4/2007 9:11:27 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

5 Replies
962 Views

Similar Articles

[PageSpeed] 42

Check permissions for the database on the server, sounds like the asp.net account doesn't have the proper permissions to access the database.

Burl

0
Burldo
9/4/2007 10:05:06 PM

The asp.net account does not have permissions to the sql server. That is by design. I am using SQL authentication with this string in the web.config:

 

<add name="TDemoSiteConnectionString" connectionString="Data Source=192.168.8.37;Initial Catalog=TDemoSite;Persist Security Info=True;User ID=TDemo;Password=fred" providerName="System.Data.SqlClient" />


Ask One/Answer One.
0
jmurdock
9/4/2007 10:23:31 PM

This article will show how to program the adapter for the connection string.

http://www.asp.net/learn/data-access/tutorial-72-vb.aspx

Burl 

 

0
Burldo
9/4/2007 11:40:43 PM

jmurdock:
login failed for user null
 

Hi jmurdock,

Base on my understanding, the root reason is not associate with a true SQL Server connection.

Through search, I find an article, it is very close your problem, and it is very close my idea.Big Smile

Check out the following link, and follow it step by step: http://geekswithblogs.net/ranganh/archive/2005/05/25/40489.aspx

Please connect me if I misunderstood your mean, 

Hope it helps,

Hong Gang
 

 


Hong-Gang Chen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Hong
9/7/2007 8:29:24 AM

Thanks for your help guys,

Here's how I solved it: 

Dim td As New TDataTableAdapters.prSelectRFQsByUserIDTableAdapter
'*** Added Sept 6, 2007 to fix data conn issue
Dim Conn As New System.Data.SqlClient.SqlConnection
Conn.ConnectionString = ConfigurationManager.ConnectionStrings("TDemoSiteConnectionString").ConnectionString
td.Connection = Conn
'*** End of add
td.Fill(QBU, strUserID, Complete, Quoted)
td.Dispose()
It seems that even though I set the connection to the same one (above) using VS 2005 pre-compile, these particular 
table adapters were trying to log into the sql server using the windows credentials (or something). When I added the
code above I was able to force the code to use the correct connection.
Thanks for your help.

Ask One/Answer One.
0
jmurdock
9/7/2007 1:14:19 PM
Reply:

Similar Artilces:

2008 IIS7 connection to SQL Server 2000 on Web Server 2000: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
I am setting up a windows 2008 IIS7 web server, and trying to connect to a windows 2000 sql server 2000 database. I have an IIS6 Windows 2000 web server activately connected just fine. I have anonymous and windows authentication enabled. And in my web.config I have identity impersonate="true" My sql server 2000 typically uses the IISUSER anonymous user set up in IIS6 on my original windows 2000 web server. But this new IIS7 is giving me grief. I can't seem to setup the IUSR or IISUSER or anything in it. I can't even use sql server credentials in my connection string altho...

[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Hello All, I'm Getting the following error when calling a dll from my vb.net application. [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. The dll was written in vb6 and accesses a sql db using the following connection string. Public Const GLOBAL_DNS As String = "DSN=TransSrvFinal;UID=sa;PWD=admin;" This DLL works fine when called from other Windows Apps. However I'm now trying to call this dll from with in an asp.net application. I'm using vb.net as the codebehind. I'm a...

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection
Dear All,I am trying to establish a connection to my SQL Server which is on the Remote machine. My ASP.Net application is on the local machine. Below is my connection string: <appSettings><add key="NorthConn" value="server=ABC;integrated security=sspi;database=Northwind"/></appSettings>The North wind Database has the following user accounts:1) ABC\ASPNET2)ABC\IUSR_ABCboth of these accounts have permissions granted to them.My SQL Server has both Windows and SQL Server authentication checked. I checked the properties of my  web project in IIS  and it has both Anony...

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection
I dont believe that no one can help me in this damn error,Please, I'm gonne lose my job offer If I didnt fix this. I have spent 7 days searching with no use !! I use ASP.NET 2.0 with C# to develop an intranet site, it was working perfectly when i was on Visual Studio, when i tried to publish the site it gave me that error. Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. the web application on IIS server, windows 2003 - the database on a different server windows 2003, sql server 2000. Regaeding that we have proxy server, one fi...

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection
Hi i installed msde with follwoing attributes for a project DotnetNUke..C:\sql2ksp3\MSDE\>Setup.exe SAPWD="password "INSTANCENAME="DNNV3" SECURITYMODE=SQLin my web.config file here is what i am using==><appSettings>    <add key="SiteSqlServer" value="Server=(local);Database=DNNV3;uid=;pwd=password;" />   but i am getting below error...can anyone PLEASE help me on this.thanks a lotInstalling DotNetNukeUpgrade Error: ERROR: Could not connect to database specified in connectionString for SqlDataProvider   ---------------------------------------------...

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection #2
Hello,since now we had the SQL Server(2000,SP4) and the IIS on one Windows 2003 Server running. Now we shared both. One Server for SQL Server and one for the IIS. But now we always get this error Message:Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connectionHas anyone an idea how we can solve the problem ? On the IIS Integrated Windows Authentication is activated.GreetingsBN...

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection #2
I realize people have had this problem before. Probably on this very board. But I am up against a wall and none of the solutions I have found online work at all. I have a asp.net 1.x application that sits on an IIS server and talks to an SQL 2000 database on a separate server. It was working fine until about a week ago when all of the sudden I started recieving the following error: "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection" In IIS manager the application is set up in a virtual directory, denies anonymous users, and uses only Integrat...

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection #3
Hi I have am developing on xp machine with iis 5.1 and trying to connect to a seperate windows 2003 machine with mssql 2000 installed.I would like to use a trusted connection and I added an asp account on the sql server with permissions to the database and also edited the security tab on IIS to have this account. I unchecked allow IIS to control this password.  When I look in the event viewer on my local machine I get an error:Process information:     Process ID: 2388     Process name: aspnet_wp.exe     Account name: MACHINENAME\ASPNET &...

Web resources about - Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. - asp.net.web-forms

Sources: The Beatles will be available for streaming on Spotify, Apple Music, Google Play, Tidal, Amazon's ...
Peter Kafka / Re/code : Sources: The Beatles will be available for streaming on Spotify, Apple Music, Google Play, Tidal, Amazon's Prime Music, ...

Ted Cruz Would NEVER Exploit His Kids, Says Ted Cruz as He Exploits His Kids
Ted Cruz is positively SICKENED by how low the liberal media is willing to go “to attack and destroy” him and everyone he holds dear, specifically ...

SpaceX Falcon 9 Rocket Successfully Completes Vertical Landing in a Spaceflight First
The final frontier might finally get more accessible sometime soon — in a huge accomplishment for spaceflight and Elon Musk’s SpaceX, the Falcon ...

Google's robot Christmas card is seriously disturbing
Boston Dynamics, a robotics company that's a part of Google X, itself a subsidiary of Alphabet, today posted a Christmas video that's best described ...

Driver who plowed into Las Vegas crowd charged with murder
An Oregon woman accused of plowing her car into a crowd on the Las Vegas Strip, killing one person and injuring dozens, was charged with murder ...

Sanders Supporters Hijack Fox News User Poll, Give Bernie 41% of Total Vote
Fox Nation, the official user-generated content arm of the Fox News digital media wing, brands itself with “America’s Talking – All Opinions ...

Miss Colombia Writes Emotional Message to Fans After Miss Universe Mistake
Miss Colombia Ariadna Gutierrez has taken to her Instagram account to write an emotional and touching note to her fans about her experience in ...

More than 1 million refugees enter Europe this year (+video)
The milestone represents the largest movement of migrants since World War II. EU countries continue to grapple with what to do, as the death ...

The Biggest Company In Tech Fears Britain's "Snooper Charter"—And Startups Should, Too
This post appears courtesy of the Ferenstein Wire, a syndicated news service. Publishing partners may edit posts. For inquiries, please email ...

Bowe Bergdahl Arraigned at Army Base in North Carolina
At Fort Bragg, North Carolina, on Tuesday, Sgt. Bowe Bergdahl, who is charged with desertion and misbehavior before the enemy , faced a military ...

Resources last updated: 12/23/2015 4:41:44 AM