Read data from MS ACCESS Database
Free code, example code, sample code
Step 3: Select the following references
Step 4: Create MS ACCESS Database
Step 5: Add text-box and button
Step 5: Paste this VBScript
Private Sub Command1_Click()
Dim strfile As String
Dim Strcon As String
Dim sqlstr As String
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
strfile = "C:\Database.mdb"
Strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strfile & ";"
Set rs = New ADODB.Recordset
cn.Open Strcon
sqlstr = "SELECT * from Temperature_Data"
rs.Open sqlstr, cn, adOpenDynamic, adLockOptimistic
Text1.Text = rs!Present_Value
Text2.Text = rs!Set_Point
rs.Close
cn.Close
End Sub
Enjoy! Now you can able to read present value and setpoint from database
No comments:
Post a Comment