Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 asp SQL Server Connection

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-09-16 : 20:29:51
Jerry writes "This is one time I have no wish to stump The Almighty One.

I am having problems connecting to an SQL Server Database using a dsn or dsnless connection. I would prefer the latter but at this point I will take anything.
This is the DSN code:

myDSN="DSN=irs-sqlserver;uid=;pwd="
set conn=server.createobject("adodb.connection")
conn.open myDSN
strsql = "SELECT * FROM tblUsers WHERE Username = '" & name &"' AND password = '" & pass & "'"
set rs = Conn.execute(strsql)

I get this error:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'SMITH1\IUSR_OEMCOMPUTER'

When I test the System DSN the connection passes.

When I try a DSNless connection I used the following code:
Dim Conn, rs
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=IRSSQL;Data Source=SMITH1"
strsql = "SELECT * FROM tblUsers WHERE Username = '" & name &"' AND password = '" & pass & "'"
set rs = Conn.execute(strsql)

I get the same error:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user 'SMITH1\IUSR_OEMCOMPUTER'

I am running Windows 2000. SQL Server 7. Any Ideas?"

   

- Advertisement -