-
Query MS Access database
Hello,
I'm trying to query am MS Access database from .vbs file
This file will run by an sms gateway when a message is received.
The following is a sample that is provided by the sms software:
===sample.vbs==================
'This sample SMSReceive script simply returns the message to the sender
set Args = Wscript.Arguments
'Get details of received message
PhoneNumber = Args(0)
MessageText = Args(1)
Handset = Args(2)
'Create ActiveSMS COM Object
Set ActiveSMS = WScript.CreateObject("Intellisoftware.ActiveSMS")
'TODO : Add your code here for Info-on-demained service (e.g. Query database etc)
'Send message back to sender
ActiveSMS.ActiveHandset = Handset
ActiveSMS.SendMessage PhoneNumber, MessageText, 0
=======================================
Now add my code as shown below:
========test.vbs=======================
set Args = Wscript.Arguments
'Get details of received message
PhoneNumber = Args(0)
MessageText = Args(1)
Handset = Args(2)
'Create ActiveSMS COM Object
Set ActiveSMS = WScript.CreateObject("Intellisoftware.ActiveSMS")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:/Inetpub/wwwroot/SMS-Project/DATABASE/Project.mdb"
set rs=Server.CreateObject("ADODB.recordset")
SQL = "SELECT * FROM Login WHERE Username = '" + Request("MessageText") + "'"
rs.Open sql, conn
MessageText = rs("Password")
rs.close
conn.close
'Send message back to sender
ActiveSMS.ActiveHandset = Handset
ActiveSMS.SendMessage PhoneNumber, MessageText, 0
=====================================
Using the above code i'm getting the following error:
VBScript rutime error
Object Required: 'Server'
Line: 12
What i'm trying to do is to query the database using the MessageText value that will retrieve the password of this user and send it back by sms.
My concern if my connection and SQL statement are correct.
Thanks alot for your help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|