Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User input for Sql Server Details 1

Status
Not open for further replies.

VBn00b

Technical User
Mar 29, 2008
16
ZA
Hi,

I have the following connection string:

Set objConn = CreateObject("ADODB.Connection")
objConn.Open "Driver={SQL Server};" & _
"Server=127.0.0.1;" & _
"Database=Master;" & _
"user id=test;" & _
"password=test;"
Set objRSSQL = CreateObject("ADODB.Recordset")

Is it possible to have the Server IP, user id and password specified by the user with an inputbox instead of manually having to edit the script with notepad and keeping the password in there?

ServerIP = InputBox("Please enter SQL Server IP?")
msgbox "Your IP entered is: " & ServerIP
UserID = InputBox("Please enter the SQL Server username for IP: " & ServerIP)
msgbox "Your entered username is: " & UserID
PassID = InputBox("Please enter the SQL Server password for username: " & UserID)
msgbox "Your entered password is: " & PassID

' "Server="&ServerIP&";" & _
' "user id="&UserID&";" & _
' "password="&PassID&";"

Can someone please help with the correct syntax for those 3 lines!

Thanks :)

 
Also is it possible to use windows authentication if the script is run locally on the server? Because I was having issues since the default under security is set to "Windows Authentication Mode" and not "SQL Server and Windows Authentication Mode".

Thanks :D
 
objConn.Open "Driver={SQL Server};" & _
"Server=" & ServerIP & ";" & _
"Database=Master;" & _
"user id=" & UserID & ";" & _
"password=" & PassID & ";"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Buya its works great! Thanks PHV :) Star for you!

Any help with the windows authentication question? How would I go about changing the login from trusted sql to windows authentication?

Thanks alot :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top