急求:那位老大给我看看这段(ASP访问数据库)代码错那里了!不是很长!在线等呀!!! ( 积分: 50 )

  • 主题发起人 主题发起人 yang_ysb
  • 开始时间 开始时间
Y

yang_ysb

Unregistered / Unconfirmed
GUEST, unregistred user!
<% @ language = VBScript %>
<% Response.Buffer =True%>
<html>
<body>
<% Session(&quot;allow&quot;)=True %>
<%
UserName=Request.Form(&quot;username&quot;)
password=request.Form(&quot;password&quot;)
'获取用户输入的用户名和密码
datafile=&quot;TTBGuanLi_ysbaxp.mdb&quot;
set MyConn=server.createobject(&quot;adodb.Connection&quot;)
MyConn.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)};
data sourc= &quot;
&amp;
server.mappath(&quot;&quot;&amp;
datafile &amp;&quot;&quot;)/////////////就是里有错呀!!帮忙谢谢了!!

SQL=&quot;Select * from tbilogin&quot;
Set Rs =server.createobject(&quot;adodb.recordset&quot;)
Set Rs=MyConn.Execute(SQL)

If UserName=Rs(&quot;UserName&quot;) AND Password=RS(&quot;Password&quot;) then
'if there is a match then
show the page
%>

<hl>Hello World</hl>


<%
else
Response.Redirect &quot;http://10.0.0.3/Samples/login.asp&quot;
RS.Close
MyConn.Close
Set RS=Nothing
Set MyConn=Nothing
end if
%>
'if there was no match then
make the visitor try again to login.


</body>
</html>
 
<% @ language = VBScript %>
<% Response.Buffer =True%>
<html>
<body>
<% Session(&quot;allow&quot;)=True %>
<%
UserName=Request.Form(&quot;username&quot;)
password=request.Form(&quot;password&quot;)
'获取用户输入的用户名和密码
datafile=&quot;TTBGuanLi_ysbaxp.mdb&quot;
set MyConn=server.createobject(&quot;adodb.Connection&quot;)
MyConn.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)};
data sourc= &quot;
&amp;
server.mappath(&quot;&quot;&amp;
datafile &amp;&quot;&quot;)/////////////就是里有错呀!!帮忙谢谢了!!

SQL=&quot;Select * from tbilogin&quot;
Set Rs =server.createobject(&quot;adodb.recordset&quot;)
Set Rs=MyConn.Execute(SQL)

If UserName=Rs(&quot;UserName&quot;) AND Password=RS(&quot;Password&quot;) then
'if there is a match then
show the page
%>

<hl>Hello World</hl>


<%
else
Response.Redirect &quot;http://10.0.0.3/Samples/login.asp&quot;
RS.Close
MyConn.Close
Set RS=Nothing
Set MyConn=Nothing
end if
%>
'if there was no match then
make the visitor try again to login.


</body>
</html>
 
MyConn.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)};
data sourc= &quot;
&amp;
server.mappath(&quot;&quot;&amp;
datafile &amp;&quot;&quot;)/////////////就是里有错呀!!帮忙谢谢了!!

改为
MyConn.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=&quot;
&amp;
server.mappath(datafile)
 
MyConn.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)};
data sourc= &quot;
&amp;
server.mappath(&quot;&quot;&amp;
datafile &amp;&quot;&quot;)/////////////就是里有错呀!!帮忙谢谢了!!
data sourc
^^^^^^^^^^
拼写错误,应该是
Data Source
哈哈,不好意思白拣分了哈
 
哈哈
谢谢了
每人25分
我分不多
我是新手
谢谢两位大哥了
嘿嘿
 
后退
顶部