Forum Discussion
Colin_McCrae
Community Hero
I connect to SQL a lot from script. Works fine.
Your connection string looks the same as mine, apart form the last parameter. I use the computer name. Which I pull from an environment variable at runtime. In C# Script:
var OWS = Sys["OleObject"]("WScript.Shell"); var CompName = OWS.ExpandEnvironmentStrings("%COMPUTERNAME%")
My final parameter in the connection string is
+ ";Data Source=" + CompName;
Mine have always been on the local machine thus far, but I believe you need the IP or hostname of the remote machine (and it needs to be configured to allow remote connections to the DB I think).
tonydugay
9 years agoContributor
I agree with Colin - I connect to a remote DB and my connection string looks the same - but I use an ip address at the end of the string.
Related Content
- 6 years agoranujn
- 6 years agomcostantini
- 3 years agoMarkSchofer
- 3 years agomsalvador