Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

VBScript - Automatically pass Credentials


  • Please log in to reply

#1
Immortalarena

Immortalarena

    Member

  • Member
  • PipPipPip
  • 216 posts
I have a script that connects to an Access Database. I need to use the Access Database to read and write the data, but when the script runs I get the login prompt, meaning I have to run this job manually. Doesn anyone have any idea how I might put a username and password through to help automate this script?

I've done somethign similar before with Web Directory Security, but I'm not sure how to get my vbscript working. Any help would be greatly appreciated.


DSN="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=L:\Data.mdb;"
Set con = CreateObject("ADODB.Connection")
con.Open(dsn)

'-----------------------------------This worked in Web, but isn't working here

struserName = "USERNAME"
strPassWord = "PASSWORD"
strURL="SHAREPOINT ADDRESS"

Dim objXMLHTTP
Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Call objXMLHTTP.Open("Get", strURL, False, struserName, strPassWord)
Call objXMLHTTP.Send()

'-----------------------------------

strSQL="SELECT * FROM [Data]"
Set rstuid = CreateObject("ADODB.Recordset")
rstuid.Open strSQL, con, adOpenStatic, adLockReadOnly

rstuid.movenext

My goal is for it to be able to run without someone having to do it manually and enter in the username and password.

Thanks!
  • 0

Advertisements


#2
devper94

devper94

    Member

  • Member
  • PipPipPip
  • 817 posts
Append to the connection string
"User ID=USERNAME_HERE;Password=PASSWORD_HERE;"
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP