Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

SQL Server Connection String through a VPN

I have a VPN to a customer.

I can "trick" my SSMS into opening through a command prompt in Windows Authentication mode through that VPN
CMD>C:\Windows\System32\runas.exe /netonly /user:gplrinc\my.name "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Ssms.exe"
I am then prompted for a password which I type in and hit "Enter"

SSMS opens... I change to server instance and login

How can I replicate that with a .Net Connection string...
My VPN is open and accessible.
SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

LVL 47
I tried that using both the "windows" credentials as well as a SQL USer login I created on that SQL Server instance
tried that using both the "windows" credentials as well as a SQL USer login I created on that SQL Server instance
What's the error you got on both tentatives?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey guys...
LVL 21 ... I had tried that as one of about 30 different permutations and it did not work
This was what wound up working... and it was when I changed to [String] and Database= instead of Catalog

Dim Constring As [String] = "user id=ewUser;password=pwd;Server=servername;Database=theirdatabase_"
Shaun Vermaak reminded me to go back to basics and just work through the connection string
And objections to awarding Shaun the points?
Isn't that I said in the first instance?
"You should be able to put the user credentials directly in the connection string so you won't need the runas command."

Only difference is I didn't post any example for the connection string.
Because actual example was posted...
Awarded lions share to Shaun