使用VBScript连接,插入,删除,在ms访问数据库中搜索
问题描述:
嗨
我想知道如何连接到Ms-access数据库并使用VBScript对其进行插入,删除和搜索.
****请举例说明****
请帮助我
Hi
I want know how do I connecting to Ms-access database and insert,delete,search into it with VBScript.
****please describe with an example****
Please help me
答
类似于上述READ操作概念,您可以扩展INSERT,DELETE和UPDATE操作.如果您有任何特定的查询,请告诉我们.
Similar to above READ operation concept, you can extend INSERT, DELETE and UPDATE operation. If you have any specific query, letz know.
示例代码读取操作:
Sample code Read operation:
<html>
<Title> Read MS Access using VBScript </Title>
<body>
<h2>Employee List, sorted by Employee ID.</h2><br>
<TABLE border="1">
<TR>
<TD><B>ID</a></B></TD>
<TD><B>Name</a></B></TD>
</TR>
<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("Employee.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
SQL_query = "SELECT EmpID, EmpName "&_
"FROM EmployeeTable "&_
"ORDER BY ID;"
Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF
%>
<TR>
<TD><%=RS("EmpID")%></TD>
<TD><%=RS("EmpName")%></TD>
</TR>
<%
RS.MoveNext
WEND
RS.Close
set RS = nothing
MyConn.close
set MyConn = nothing
%>
</TABLE>
</body>
</html>