I am running into a weird situation, hoping someone here can help.
I am communicating to a MySQL database using 'MySQL ODBC 5.1 Driver', although the below code works fine when run separately on a .vbs file, when i put the same in HTA i get Error
Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I put the same code in a .vbs file and run the VBS file via an HTA using objShell.run command still the same problem.
When the VBS file is run independently or via CMD it runs fine displaying the contents. Any ideas ?
Call Query
Sub Query
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
adOpenStatic = 3
adLockOptimistic = 3
objConnection.Open _
"Driver={MySQL ODBC 5.1 Driver};Server=[Some Address];Database=bldb;User=usr;Password=pass;"
objRecordSet.Open "SELECT * FROM Clients Where Machine Like 00000" & , _
objConnection, adOpenStatic, adLockOptimistic
Do While Not objRecordSet.EOF
Company = objRecordSet (1)
Contact = objRecordSet (2)
Phone = objRecordSet (3)
objRecordSet.MoveNext
Loop
objRecordSet.Close
objConnection.Close
Set objRecordSet=Nothing
Set objConnection=Nothing
End Sub