General discussion

Locked

SQL Server Security in ADO Connection

By munrrob ·
I am writing a site using ASP pages (VBScript, ADO 2.5) and would like to create a connection to a SQL Server 2k database that will use the users NT security to log in and give permissions.

How do I code this?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by abc In reply to SQL Server Security in AD ...

Dim strConnect, Conn, Rs

strConnect = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=<user_id>;Password=<password>;Initial Catalog=<your_db_name>;Data Source=<sql_server_name>"

Set Conn = server.CreateObject("adodb.connection")
Conn.Open strConnect

Set Rs = server.CreateObject("adodb.recordset")

Rs.Open <SQL Query>, Conn

Note: Ommit <> wherever you find in above connection string

Collapse -

by munrrob In reply to

Poster rated this answer.

Collapse -

by abc In reply to SQL Server Security in AD ...

Sorry, Disregard my previous answer.. this is the correct one.

Dim strConnect, Conn, Rs

strConnect = "Provider=SQLOLEDB.1;Persist Security Info=True;Trusted_Connection=yes;User ID=<user_id>;Password=<password>;Initial Catalog=<your_db_name>;Data Source=<sql_server_name>"

Set Conn = server.CreateObject("adodb.connection")
Conn.Open strConnect

Set Rs = server.CreateObject("adodb.recordset")

Collapse -

by munrrob In reply to

Poster rated this answer.

Collapse -

by munrrob In reply to SQL Server Security in AD ...

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums