Thursday, March 29, 2012

login error failed in SQLServer - Resolved

I dont know why this error is comin in SQLHelper.vb

Line 714:
ByVal connectionOwnership As SqlConnectionOwnership) As SqlDataReader
Line 715: Dim mustCloseConnection As Boolean = False
Line 716: If (connection Is Nothing) Then Throw New ArgumentNullException("connection")
Line 717:
Line 718:' Create a command and prepare it for execution

Source File: G:\Program Files\Microsoft Application Blocks for .NET\Data Access v2\Code\VB\Microsoft.ApplicationBlocks.Data\SQLHelper.vb Line: 716

Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: connection



Please Helpis the problem with the databse conection that i am using in a class in which this SQL helper is used for data retrieving.Is this a problem of permission of the database .

I have progrmme in my localhost and database is on another server.

Should any where in ASP i have to mention about the database path or not

In vb class i have mentioned the server name and passsord and and it was working at my
PC
This is one of the core reason I hate .NET

What is Connection?

Is it a connection string, or a connection object?

Why on earth don't .NET developers use:

Dim strConn As String
'or
Dim adoConn As ADOConnection

Makes life MUCH easier.

Woka
As i am using the SQLHelper Classes thats why the connection is the SQLconnection

I think some how the server name and databas is not reaching to the Connection (i am thinking loud )

Infact i have given the proper name of server and database in my VB class which i am using and in this VB class i am using the SQL helper classes for data retrieval.

cna any body have any idea or should i stop using the SQL helper and redesign the entire data retrival
i figured out there is some problem in connectrion. some how the connection string is not appropriate. My application and my SQL server are not on one server i am kaing the connection string as follows

CONNECTIONSTRING = "data source=svr1;initial catalog=data1"



I have tried to insert integrated security and trusted connection as well but the error is still same.

I have also tried to put password and username in my connection string but itw as of no use. its giving me still following error

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

Just add this to web.config file

<authentication mode="Windows" />

<identity impersonate="true" userName="domainname\username" password="pwd"/>



offcourse the username must be recognized by SQL server.

0 comments:

Post a Comment