Need Help With VBScript

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
nelsonGTi
Newbie
Posts: 2
Joined: Fri Dec 21, 2012 5:14 pm

Need Help With VBScript

Post by nelsonGTi » Fri Dec 21, 2012 5:21 pm

Hello Everyone,

I have the following script, now I'd like to pass the results to something like
Send>%GetName%
The goal is to read from a database and then use the value to go thru a web form and enter the values from the database into the web form.

Heres what I have so far:

VBStart
Function GetName
Dim objConnection,objRecordset,strSearchCriteria, strGetName
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Const DB_CONNECT_STRING = "Provider=SQLOLEDB.1;Data Source=server;Initial Catalog=db1;user id=user;password=pass;"

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")

objConnection.Open DB_CONNECT_STRING

objRecordset.Open "SELECT T [Developer],[StartDate],[EndDate] FROM [db1].[dbo].[temp_schedule] WHERE status = 0", objConnection, adOpenStatic, adLockOptimistic

Do While Not objRecordset.EOF
Set strGetName = objRecordset("Developer")
objRecordset.MoveNext
Loop

objRecordset.Close
objConnection.Close
End Function

VBEnd

nelsonGTi
Newbie
Posts: 2
Joined: Fri Dec 21, 2012 5:14 pm

Post by nelsonGTi » Fri Dec 21, 2012 6:08 pm

I just answered my own question :oops:
...
GetName = strGetName
objRecordset.MoveNext
Loop


objRecordset.Close
objConnection.Close
End Function

VBEnd

VbEval>GetName,answer
MessageModal>answer

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts