做了一个客户端修改密码的页面。<%@import namespace="system.data.oledb"%>
<%@import namespace="system.data"%>
<%@ Page Language="vb" debug="true" %>
<script language=vb runat=server>
sub page_load(sender as object,e as eventargs)
end sub sub Addnew_Subject_Submit(sender as object,e as eventargs)
if newpassword1.text<>newpassword2.text then
statues.style("color")="red"
statues.text="输入的两个新密码不同!"
else
dim mycommand3 as OLEDBDataAdapter
dim conn as OLEDBconnection=new oledbconnection("provider=Microsoft.Jet.OLEDB.4.0;datasource=E:\EPMS\data\login.mdb;initial catalog=pubs") dim ds as dataset=new dataset
dim querystring3 as string="select * from login where password='"+password.text+"' and username='"+username.text+"'" mycommand3=new OLEDBDataAdapter(querystring3,conn)
mycommand3.fill(ds)
mydatagrid.datasource=new dataview(ds.tables(0))
mydatagrid.databind() if mydatagrid.items.count=0 then
statues.style("color")="red"
statues.text="登陆密码错误!"
else
dim myinsertquery as string="update userinfo set password='"+newpassword2.text+"' where username='"+username.text+"'"
dim myoledbcommand as new oledbcommand(myinsertquery)
myoledbcommand.connection=conn
conn.open()
myoledbcommand.executenonquery()
myoledbcommand.connection.close()
statues.style("color")="red"
statues.text="修改成功!"
end if
end if
end sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>home-main</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url();
}
.style1 {font-size: 17px}
.style3 {font-size: 16px}
-->
</style>
</head><body>
<table width="880" height="515" border="0" align="left" cellspacing="0">
<tr> <Form name=loginform action=index.asp method=post runat="server">
<td height="500" colspan="2"><div id="Layer1" style="position:absolute; width:400px; height:267px; z-index:1; left: 210px; top: 82px; background-image: url(../pic/chpwd.gif); layer-background-image: url(../pic/chpwd.gif); border: 1px none #000000; visibility: visible;">
<table width="400" height="220" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="40" colspan="4"> </td>
</tr>
<tr>
<td width="80" height="160" rowspan="6"> </td>
<td width="90" height="30" class="style1">原账户:</td>
<td width="190">
<asp:textbox runat="server" id="username" size="26" /><asp:RequiredFieldValidator id="requsername" ControlToValidate="username" runat="server" text="*" /></td>
<td width="40" rowspan="5"> </td>
</tr>
<tr>
<td width="90" height="30" class="style1">原密码:</td>
<td width="190"><asp:textbox runat="server" id="password" size="26" /><asp:RequiredFieldValidator id="reqpassword" ControlToValidate="password" runat="server" text="*" /></td>
</tr>
<tr>
<td width="90" height="30" class="style1">新密码:</td>
<td width="190"><asp:textbox runat="server" id="newpassword1" size="26" /><asp:RequiredFieldValidator id="reqnewpassword1" ControlToValidate="newpassword1" runat="server" text="*" /></td>
</tr>
<tr>
<td width="90" height="30" class="style1">确认密码:</td>
<td width="190"><asp:textbox runat="server" id="newpassword2" size="26" /><asp:RequiredFieldValidator id="reqnewpassword2" ControlToValidate="newpassword2" runat="server" text="*" /></td>
</tr>
<tr>
<td width="90" height="30" align="right" valign="bottom"> </td>
<td width="190" align="right" valign="bottom"><asp:button ID="submit" runat="server" OnClick="Addnew_Subject_Submit" style="font-weight: bold" text="修改完成" />
</td>
</tr>
<tr>
<td colspan="3"><asp:label id=statues runat=server/></td>
</tr>
</table>
</div><asp:datagrid id="mydatagrid" runat=server visible="false"/></td>
<td width="20" rowspan="2" bgcolor="#7c7a7b"> </td></Form>
</tr>
<tr>
<td width="78" height="15" background="../pic/80-15.gif"> </td>
<td width="782" height="15" bgcolor="#7c7a7b"> </td>
</tr>
</table>
</body>
</html>
运行后页面可显示,但做该密码操作后报错:
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.Source Error:
Line 19:
Line 20: mycommand3=new OLEDBDataAdapter(querystring3,conn)
Line 21: mycommand3.fill(ds)
Line 22: mydatagrid.datasource=new dataview(ds.tables(0))
Line 23: mydatagrid.databind()
Source File: E:\EPMS\home\7-2.aspx Line: 21 偶是初学者,上面的代码可能还会有很多其他问题,望各位大侠赐教。
小女子感激不尽!!!
由于偶是新手,还请各位说得尽量具体一点,谢谢谢啦!!!:)
<%@import namespace="system.data"%>
<%@ Page Language="vb" debug="true" %>
<script language=vb runat=server>
sub page_load(sender as object,e as eventargs)
end sub sub Addnew_Subject_Submit(sender as object,e as eventargs)
if newpassword1.text<>newpassword2.text then
statues.style("color")="red"
statues.text="输入的两个新密码不同!"
else
dim mycommand3 as OLEDBDataAdapter
dim conn as OLEDBconnection=new oledbconnection("provider=Microsoft.Jet.OLEDB.4.0;datasource=E:\EPMS\data\login.mdb;initial catalog=pubs") dim ds as dataset=new dataset
dim querystring3 as string="select * from login where password='"+password.text+"' and username='"+username.text+"'" mycommand3=new OLEDBDataAdapter(querystring3,conn)
mycommand3.fill(ds)
mydatagrid.datasource=new dataview(ds.tables(0))
mydatagrid.databind() if mydatagrid.items.count=0 then
statues.style("color")="red"
statues.text="登陆密码错误!"
else
dim myinsertquery as string="update userinfo set password='"+newpassword2.text+"' where username='"+username.text+"'"
dim myoledbcommand as new oledbcommand(myinsertquery)
myoledbcommand.connection=conn
conn.open()
myoledbcommand.executenonquery()
myoledbcommand.connection.close()
statues.style("color")="red"
statues.text="修改成功!"
end if
end if
end sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>home-main</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url();
}
.style1 {font-size: 17px}
.style3 {font-size: 16px}
-->
</style>
</head><body>
<table width="880" height="515" border="0" align="left" cellspacing="0">
<tr> <Form name=loginform action=index.asp method=post runat="server">
<td height="500" colspan="2"><div id="Layer1" style="position:absolute; width:400px; height:267px; z-index:1; left: 210px; top: 82px; background-image: url(../pic/chpwd.gif); layer-background-image: url(../pic/chpwd.gif); border: 1px none #000000; visibility: visible;">
<table width="400" height="220" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="40" colspan="4"> </td>
</tr>
<tr>
<td width="80" height="160" rowspan="6"> </td>
<td width="90" height="30" class="style1">原账户:</td>
<td width="190">
<asp:textbox runat="server" id="username" size="26" /><asp:RequiredFieldValidator id="requsername" ControlToValidate="username" runat="server" text="*" /></td>
<td width="40" rowspan="5"> </td>
</tr>
<tr>
<td width="90" height="30" class="style1">原密码:</td>
<td width="190"><asp:textbox runat="server" id="password" size="26" /><asp:RequiredFieldValidator id="reqpassword" ControlToValidate="password" runat="server" text="*" /></td>
</tr>
<tr>
<td width="90" height="30" class="style1">新密码:</td>
<td width="190"><asp:textbox runat="server" id="newpassword1" size="26" /><asp:RequiredFieldValidator id="reqnewpassword1" ControlToValidate="newpassword1" runat="server" text="*" /></td>
</tr>
<tr>
<td width="90" height="30" class="style1">确认密码:</td>
<td width="190"><asp:textbox runat="server" id="newpassword2" size="26" /><asp:RequiredFieldValidator id="reqnewpassword2" ControlToValidate="newpassword2" runat="server" text="*" /></td>
</tr>
<tr>
<td width="90" height="30" align="right" valign="bottom"> </td>
<td width="190" align="right" valign="bottom"><asp:button ID="submit" runat="server" OnClick="Addnew_Subject_Submit" style="font-weight: bold" text="修改完成" />
</td>
</tr>
<tr>
<td colspan="3"><asp:label id=statues runat=server/></td>
</tr>
</table>
</div><asp:datagrid id="mydatagrid" runat=server visible="false"/></td>
<td width="20" rowspan="2" bgcolor="#7c7a7b"> </td></Form>
</tr>
<tr>
<td width="78" height="15" background="../pic/80-15.gif"> </td>
<td width="782" height="15" bgcolor="#7c7a7b"> </td>
</tr>
</table>
</body>
</html>
运行后页面可显示,但做该密码操作后报错:
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.Source Error:
Line 19:
Line 20: mycommand3=new OLEDBDataAdapter(querystring3,conn)
Line 21: mycommand3.fill(ds)
Line 22: mydatagrid.datasource=new dataview(ds.tables(0))
Line 23: mydatagrid.databind()
Source File: E:\EPMS\home\7-2.aspx Line: 21 偶是初学者,上面的代码可能还会有很多其他问题,望各位大侠赐教。
小女子感激不尽!!!
由于偶是新手,还请各位说得尽量具体一点,谢谢谢啦!!!:)
If newpassword1.text <> newpassword2.text Then
statues.style("color") = "red"
statues.text = "输入的两个新密码不同!"
Else
Dim conn As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;datasource=E:\EPMS\data\login.mdb;")
Dim mycommand3 As OleDbDataAdapter
'Dim conn As OLEDBconnection = New oledbconnection("provider=Microsoft.Jet.OLEDB.4.0;datasource=E:\EPMS\data\login.mdb;initial catalog=pubs") Dim ds As New DataSet
Dim querystring3 As String = "select * from login where [password]='" + password.text + "' and username='" + username.text + "'" mycommand3 = New OLEDBDataAdapter(querystring3, conn)
mycommand3.fill(ds)
mydatagrid.datasource = New DataView(ds.tables(0))
mydatagrid.databind() If mydatagrid.items.count = 0 Then
statues.style("color") = "red"
statues.text = "登陆密码错误!"
Else
Dim myinsertquery As String = "update userinfo set [password]='" + newpassword2.text + "' where username='" + username.text + "'" Dim myoledbcommand As New oledbcommand(myinsertquery)
myoledbcommand.connection = conn
conn.Open()
myoledbcommand.executenonquery()
myoledbcommand.connection.close()
statues.style("color") = "red"
statues.text = "修改成功!"
conn.Close()
End If
End If
End Sub
毕竟都有提示。。恩
显示错误:Could not find installable ISAM.
求解ing
-----------------------------------------------
安全隐患!
万能密码