asp连接数据库
yanxh 2000-02-23 12:15:00 我编写了一个asp文件,是连接数据库的,可是老是出现错误,我已建立了系统DSN了,没有UID和PWD.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>New Page 1</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<meta name="Microsoft Theme" content="global 101, default">
<meta name="Microsoft Border" content="tl, default">
</head>
<body>
<p><%Set MyConnection = Server.CreateObject("ADODB.Connection")
MyConnection.Open "AddressBook","",""
Set MyCommand=Server.CreateObject("ADODB.Command")
MyCommand.CommandType=1
MyCommand.CommandText="select * from person where name='"&Request.Form("T1")&"'"
Set myp1=MyCommand.CreateParameter("mname",129,1,10)
MyCommand.Parameters.append myp1
MyCommand.Parameters("mname")=Request.Form("T1")
Set MyCommand.ActiveConnection=MyConnection
Set RS1=MyCommand.Execute
if RS1.EOF then
Response.Write "没有这个人唷!"
Set RS1=Nothing
Set MyConnection=Nothing
Set MyCommand=Nothing
else
Response.Write RS1.Fields("name")
Response.Write RS1.Fields("tel")
Response.Write RS1.Fields("addr")
Set RS1=Nothing
Set MyConnection=Nothing
Set MyCommand=Nothing
end if
%>
</body>
</html>
错误信息如下:
Provider 错误 '80040154'
类没有注册
/homer/asp/check1.asp, 行18
我也检查了数据源DSN也没有写错呀.请帮忙.我的email: directory@sina.com