Wrox Home  
Search P2P Archive for: Go

  Return to Index  

ado_dotnet thread: I use nt to login in to sql


Message #1 by "Scott Wiseman" <scott.wiseman@f...> on Fri, 15 Nov 2002 12:04:02 -0800
Login failed for user '(null)'. Reason: Not associated with a trusted
SQL Server connection.


<my connection string>

con =3D New SqlConnection("data source=3DSomeHost;
initial catalog=3Dnewdatabase; " & _
"Integrated Security=3DSSPI; ")

How can I log into the sql server
without a user id=3Dsa I want the securest
way to log in...

please help
Message #2 by "David Garner" <dgarner@g...> on Sat, 16 Nov 2002 00:25:51
Try adding "persist security info=False;workstation id=<whatitis>;"

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

integrated security=SSPI;persist security info=False;workstation id=0-410-
DLG;
<my connection string>

con =3D New SqlConnection("data source=3DSomeHost;
initial catalog=3Dnewdatabase; " & _
"Integrated Security=3DSSPI; ")

How can I log into the sql server
without a user id=3Dsa I want the securest
way to log in...

please help
Message #3 by "Keith Walda" <kwalda@c...> on Sat, 16 Nov 2002 00:39:23
> Login failed for user '(null)'. Reason: Not associated with a trusted
SQL Server connection.


<my connection string>

con =3D New SqlConnection("data source=3DSomeHost;
initial catalog=3Dnewdatabase; " & _
"Integrated Security=3DSSPI; ")

How can I log into the sql server
without a user id=3Dsa I want the securest
way to log in...

please help



Hello Scott.

I had a similar problem. I was using Win2k and SQL2K with NT trusted 
logins.  The only conneciton string I got to work was :

m_ConnectionString As String = "data source=SQLSERVERNAME;initial 
catalog=SQLDATABASENAME;integrated security=SSPI;persist security 
info=False;workstation id=MACHINENAME;packet size=4096"

Note the items in all caps.
SQLSERVERNAME = name of the SQL server trying to connect to.
SQLDATABASENAME = name of the SQL db tyring to connec to.
MACHINENAME = the name of the pc trying to obtain the trusted connection.

Like I said this was the only one I could get to work. I go this by using 
the Server Explorer in VS.Net and draggin over a database. I then right 
clicked on the connection, choose properties and was able to access the 
connection string.

Good luck
Message #4 by "Scott Wiseman" <scott.wiseman@f...> on Fri, 15 Nov 2002 17:40:07 -0800
I tried this

  'con =3D New SqlConnection(" data source=3D192.168.0.118 ; initial
catalog=3DTEST; " & _
            '                       " integrated security=3DSSPI; 
persist
security info=3DFalse; " & _
            '                      " workstation id=3DHOST01 ; packet
size=3D4096 ")

  'con =3D New SqlConnection(" data source=3DHOST02  ; initial 
catalog=3DTEST;
" & _
            '                       " integrated security=3DSSPI; 
persist
security info=3DFalse; " & _
            '                      " workstation id=3DHOST01 ; packet
size=3D4096 ")

but I could not insert...


---- the rest of the code ---


            sql =3D " INSERT INTO TBLmembers " & _
                  " (email,passcode,zipcode,favoritecuisine,age )" & _
                  "VALUES
(@email,@passcode,@zipcode,@favoritecuisine,@age)"

            cmd =3D New SqlCommand(sql, con)

            Dim p_email As New SqlParameter("@email", SqlDbType.VarChar,
100)
            Dim p_passcode As New SqlParameter("@passcode",
SqlDbType.VarChar, 8)
            Dim p_zipcode As New SqlParameter("@zipcode",
SqlDbType.VarChar, 12)
            Dim p_favoritecuisine As New
SqlParameter("@favoritecuisine", SqlDbType.Int)
            Dim p_age As New SqlParameter("@age", SqlDbType.Int)

            With cmd.Parameters
                .Add(p_email).Value =3D txtEmail.Text
                .Add(p_passcode).Value =3D txtpwd1.Text
                .Add(p_zipcode).Value =3D txtzip.Text
                .Add(p_favoritecuisine).Value =3D 1
                .Add(p_age).Value =3D txtage.Text
            End With



            Try
                cmd.Connection.Open()
                cmd.ExecuteNonQuery()
                Me.Response.Redirect("http://user.aspx")
            Catch
                Me.LBLmessage.Visible =3D True
                Me.LBLmessage.Text =3D " Error did not insert value"
            Finally
                cmd.Connection.Close()

            End Try

-------------------------------

-----Original Message-----
From: Keith Walda [mailto:kwalda@c...]
Sent: Friday, November 15, 2002 4:39 PM
To: ADO.NET
Subject: [ado_dotnet] Re: I use nt to login in to sql


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


<my connection string>

con =3D3D New SqlConnection("data source=3D3DSomeHost;=3D20
initial catalog=3D3Dnewdatabase; " & _
"Integrated Security=3D3DSSPI; ")

How can I log into the sql server
without a user id=3D3Dsa I want the securest
way to log in...

please help



Hello Scott.

I had a similar problem. I was using Win2k and SQL2K with NT trusted
logins.  The only conneciton string I got to work was :

m_ConnectionString As String =3D "data source=3DSQLSERVERNAME;initial
catalog=3DSQLDATABASENAME;integrated security=3DSSPI;persist security
info=3DFalse;workstation id=3DMACHINENAME;packet size=3D4096"

Note the items in all caps.
SQLSERVERNAME =3D name of the SQL server trying to connect to.
SQLDATABASENAME =3D name of the SQL db tyring to connec to.
MACHINENAME =3D the name of the pc trying to obtain the trusted
connection.

Like I said this was the only one I could get to work. I go this by
using
the Server Explorer in VS.Net and draggin over a database. I then right
clicked on the connection, choose properties and was able to access the
connection string.

Good luck
Message #5 by "Ken Schaefer" <ken@a...> on Mon, 18 Nov 2002 13:53:22 +1100
You need to grant dbaccess (in the SQL Server) to whatever account you are
running this program/asp.net page under.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Scott Wiseman" <scott.wiseman@f...>
Subject: [ado_dotnet] I use nt to login in to sql


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


<my connection string>

con = New SqlConnection("data source=SomeHost;
initial catalog=newdatabase; " & _
"Integrated Security=SSPI; ")

How can I log into the sql server
without a user id=sa I want the securest
way to log in...

please help

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index