<%@ Page Language="vb" Debug=true%>
<%@ import namespace="system.data"%>
<%@ import namespace="system.data.oledb"%>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="vb" runat="server">
sub buttonlogin_click(obj as object,e as eventargs)
dim rd as oledbdatareader
dim lrd
dim conn as oledbconnection=nothing
dim connflag as boolean=false
dim connstr,sql as string
connstr= "provider=microsoft.jet.oledb.4.0;data source="&server.mappath("tgTimeSheet.mdb")
conn= new oledbconnection(connstr)
conn.open()
'connflag=grantreadaccesstosysobjects()
sql= "select * from user where name='" & Txtname.text & "'"
dim cmd as oledbcommand= new oledbcommand(sql,conn)
'cmd
'cmd.activeconnection.open()
lrd=cmd.executereader()
rd=lrd
'cmd.execute(rd)
'If rd.EOF And rd.BOF Then
' response.write '对不起,你没有写这天的日记呢,:)'
'else
while rd.read()
if rd.item("pwd")<>trim(txtpwd.text) then
label.text="密码错误!请查证后输入!"
end if
end while
rd.close
conn.close
end sub
</script>
</head>
<body bgcolor="#94CBFF">
<form runat="server">
<table width="256" border="1" align="center">
<tr>
<td width="67" height="27">用户名:</td>
<td width="173">
<asp:TextBox ID="TxtName" ToolTip="请输入密码" TextMode="SingleLine" runat="server" />
</td>
</tr>
<tr>
<td height="25">密码:</td>
<td>
<asp:TextBox ID="Txtpwd" ToolTip="请输入密码" TextMode="Password" runat="server" />
</td>
</tr>
<tr>
<td height="25"> </td>
<td>
<center><asp:Button ID="Buttonlogin" Text="登录" OnClick="buttonlogin_click" runat="server" /></center>
<div align="left"></div></td>
</tr>
<tr><td height="23" colspan="2">
<asp:Label ID="Label" runat="server" />
</td>
</tr>
</table>
</form>
</body>
</html>当运行到lrd=cmd.executereader()时,就会出错如下:
Exception Details: System.Data.OleDb.OleDbException: FROM 子句语法错误。
大家帮帮忙, 这是怎么回事呢,?
<%@ import namespace="system.data"%>
<%@ import namespace="system.data.oledb"%>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="vb" runat="server">
sub buttonlogin_click(obj as object,e as eventargs)
dim rd as oledbdatareader
dim lrd
dim conn as oledbconnection=nothing
dim connflag as boolean=false
dim connstr,sql as string
connstr= "provider=microsoft.jet.oledb.4.0;data source="&server.mappath("tgTimeSheet.mdb")
conn= new oledbconnection(connstr)
conn.open()
'connflag=grantreadaccesstosysobjects()
sql= "select * from user where name='" & Txtname.text & "'"
dim cmd as oledbcommand= new oledbcommand(sql,conn)
'cmd
'cmd.activeconnection.open()
lrd=cmd.executereader()
rd=lrd
'cmd.execute(rd)
'If rd.EOF And rd.BOF Then
' response.write '对不起,你没有写这天的日记呢,:)'
'else
while rd.read()
if rd.item("pwd")<>trim(txtpwd.text) then
label.text="密码错误!请查证后输入!"
end if
end while
rd.close
conn.close
end sub
</script>
</head>
<body bgcolor="#94CBFF">
<form runat="server">
<table width="256" border="1" align="center">
<tr>
<td width="67" height="27">用户名:</td>
<td width="173">
<asp:TextBox ID="TxtName" ToolTip="请输入密码" TextMode="SingleLine" runat="server" />
</td>
</tr>
<tr>
<td height="25">密码:</td>
<td>
<asp:TextBox ID="Txtpwd" ToolTip="请输入密码" TextMode="Password" runat="server" />
</td>
</tr>
<tr>
<td height="25"> </td>
<td>
<center><asp:Button ID="Buttonlogin" Text="登录" OnClick="buttonlogin_click" runat="server" /></center>
<div align="left"></div></td>
</tr>
<tr><td height="23" colspan="2">
<asp:Label ID="Label" runat="server" />
</td>
</tr>
</table>
</form>
</body>
</html>当运行到lrd=cmd.executereader()时,就会出错如下:
Exception Details: System.Data.OleDb.OleDbException: FROM 子句语法错误。
大家帮帮忙, 这是怎么回事呢,?
解决方案 »
- asp.net给出错误的ORACLE exception
- jquery ajax 返回select无效
- 共三个页面,第一页通过超链接?后传的值,通过第二页,怎样在第三页得到?
- |zyciis| 第二贴 一个网站要改为虚拟目录,那里面的路径都要怎么来改呢? 因为连接和图片我都是用"/"开头的 谢谢 用替换或用静态类
- 请教:用c#如何统计静态页面?
- 如何readonly的TextBox结果保存到后台去?
- 求代码,将exel中从第十行开始的数据导入到sql server中
- 哪位高手能提供MCAD考试资料???
- ConfigurationSettings.AppSettings
- 生成组件对象时提示我必须有<%@ Page aspcompat=true %>,这是什么意思呀?
- 没分了,问一个简单的问题,请各位大侠指点一下
- 超简单问题,解决后即刻结帖!!!
试试看呢
label.text= "对不起,不存在这个用户!:)"
end if