Scott,
Hopefully it just that it's late, but is there a somwhat easy way to lookup a record # in a .mdb database and set several properties based on that record without resorting to writing a device plugin???
erie
stupid question regarding database lookup
-
- Member
- Posts: 28
- Joined: Sun Jun 15, 2003 12:33 pm
- Location: shelbyville, IL
- Contact:
Erie,
You can use a Script Device to do this. Here's a sample that shows the basics. You would need to change the various parts of the script to point to your DB and data, but it should give you an idea of what to do.
You can use a Script Device to do this. Here's a sample that shows the basics. You would need to change the various parts of the script to point to your DB and data, but it should give you an idea of what to do.
ScottSet dbConn = CreateObject( "ADODB.Connection" )
' Set path to MDB file in variable
Dim pathToDB
pathToDB = "\Program Files\HouseBot\Config\HBData.mdb"
' Open connection to DB
dbConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathToDB
' Execute query for the Description of the System Time Device
Set rs = dbConn.Execute( "select Description from Devices where Name='System Time'" )
' Check the result
if (rs.EOF) Then
MsgBox( "No Data Found" )
Else
MsgBox( rs("Description") ) ' Show result in message box
' Now set a Property Value with the new value.
SetPropertyValue "DB Update (Script).Test Value", rs("Description" )
End If