<html>
<head><title>演示连接数据库</title></head>
<body>
<%
'Server对象的CreateObject方法建立Connection
Set Conn = Server.CreateObject("ADODB.Connection")
'设置Connection对象的ConnectionString
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("down.mdb")
Conn.Mode = 3
'连接数据库
Conn.Open
'执行insert命令
Conn.Execute("insert into Class (classname,upperid) values ('理财软件',0)")
'显示提示信息
Response.Write("已经在表Class中增加了"理财软件"项目,请检查")
'断开数据库连接
Conn.Close
if Conn.State = 0 then
End if
'释放Connection对象,关闭数据库
Set Conn = nothing
%>
</body>
</html>
<head><title>演示连接数据库</title></head>
<body>
<%
'Server对象的CreateObject方法建立Connection
Set Conn = Server.CreateObject("ADODB.Connection")
'设置Connection对象的ConnectionString
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("down.mdb")
Conn.Mode = 3
'连接数据库
Conn.Open
'执行insert命令
Conn.Execute("insert into Class (classname,upperid) values ('理财软件',0)")
'显示提示信息
Response.Write("已经在表Class中增加了"理财软件"项目,请检查")
'断开数据库连接
Conn.Close
if Conn.State = 0 then
End if
'释放Connection对象,关闭数据库
Set Conn = nothing
%>
</body>
</html>