SPONSORS:






View RSS Feed

gm0716

Vbscript connection to sql server with Windows Authentication across different domain

Rate this Entry
by , 06-30-2015 at 09:08 AM (10128 Views)
I am trying to connect to SQL server with windows Authentication through VBA. Using the following code,it connects if I am in the same domain.
Set rec = CreateObject("ADODB.Recordset")
Set conn = CreateObject("ADODB.Connection")
On Error Resume Next
conn.Open "DRIVER={SQL Server};Server=exampledb;Database=example;Trusted_ Connection=yes;"
If (Err.Number <> 0) Then
'MsgBox Err.Description
SQL_CON_Single = x
Exit Function
End If
since I cannot use MSSQL Server authentication how do I get connected to different domain with VBA (windows authentication).
All information available online talks about using " runas domain\user /netonly ssms.exe " command. How do I use it in VBA (with out opening Sqlserver management studio)
Tags: None Add / Edit Tags
Categories
Uncategorized

Comments


vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:36 PM.

Copyright BetaSoft Inc.