-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAccess.hta
executable file
·66 lines (50 loc) · 1.58 KB
/
Access.hta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<title>Connect to Access db</title>
<HTA:APPLICATION
APPLICATIONNAME = "Connect to Access db"
ICON = "599CD.ico"
/>
<script language="vbscript">
Sub FillNames()
' Connection String
Dim sConnect
'Commands
Dim objCmd
'RecordSets
Dim objRS
'Initialize Connection String to connect to an MS Access Database
'sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=PCResale.mdb;Persist Security Info=False"
sConnect = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=PCResale.accdb;Persist Security Info=False"
'Create a command object to execute Advancded SQL Statements
Set objCmd = CreateObject("ADODB.Command")
objCmd.ActiveConnection = sConnect 'Connect to database
' Total Number of Submissions per supervisor
' Supervisor & CountOfRating
objCmd.CommandText = "SELECT FirstName FROM CustomerT;"
' Create the actual recordset to be used in this script
' and retrieve or display information from database
Set objRS = CreateObject("ADODB.Recordset")
Set objRS = objCmd.Execute
Dim strCustomers
While Not objRS.EOF
'msgbox objRS(0)
'msgbox objRS("FirstName")
strCustomers = strCustomers & objRS("FirstName") & ","
objRS.MoveNext
Wend
'msgbox strCustomers
myContent.innerHTML = "<p>Names: " & strCustomers & "</p>"
'Clean Up and Close
objRS.Close
Set objRS = Nothing
End Sub
</script>
</head>
<body onload="FillNames()">
<h1>Connect to Access Db</h1>
<div id="myContent">
</div>
</body>
</html>