<%@ Page Language="vb" debug="true" %>
<%@ import Namespace="system.data" %>
<%@ import Namespace="system.data.oledb" %>
<script language="vb" runat="server">
sub button_click(sender as object,e as eventargs)
dim request_username as string=TextBox1.text.trim()
dim request_company as string=TextBox2.text.trim()
dim request_add as string=TextBox3.text.trim()
dim request_tel as string=TextBox4.text.trim()
dim request_fax as string=TextBox5.text.trim()
dim request_linkman as string=TextBox6.text.trim()
dim request_email as string=TextBox7.text.trim()
dim request_website as string=TextBox8.text.trim()
dim request_content as string=TextBox9.text.trim()
dim request_time as datetime=system.datetime.now
dim dsn as string="Provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("db.mdb"
dim conn as oledbconnection=new oledbconnection(dsn)
conn.open()
dim strsql as string="insert into guestbook(username,company,add,tel,fax,linkman,email,website,content,login_time) values('"& request_username &"','"& request_company &"','"& request_add &"','"& request_tel &"','"& request_fax &"','"& request_linkman &"','"& request_email &"','"& request_website &"','"& request_content &"','"& request_time &"')"
dim cmd as oledbcommand=new oledbcommand(strsql,conn)
cmd.executenonquery()
end sub
</script>
<html>
<head></head>
<body>
<form runat="server">
<table cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
<tbody>
<tr>
<td>
<img height="36" src="order1.gif" width="188" /><img height="36" src="wsdd.gif" width="131" /></td>
</tr>
<tr>
<td>
<table cellspacing="0" cellpadding="4" width="100%" align="center" border="0">
<tbody>
<tr>
<td width="60">
姓名:</td>
<td>
<asp:TextBox id="TextBox1" runat="server" Width="100px" MaxLength="4"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="姓名必须填写" ControlToValidate="TextBox1" Display="Dynamic">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
公司名称:</td>
<td>
<asp:TextBox id="TextBox2" runat="server" Width="350px"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ErrorMessage="公司名称必须填写" ControlToValidate="TextBox2" Display="Dynamic">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
地址:</td>
<td>
<asp:TextBox id="TextBox3" runat="server" Width="350px"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" ErrorMessage="地址必须填写" ControlToValidate="TextBox3" Display="Dynamic">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
电话:</td>
<td>
<asp:TextBox id="TextBox4" runat="server" Width="100px" MaxLength="13"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator4" runat="server" ErrorMessage="电话必须填写" ControlToValidate="TextBox4" Display="Dynamic">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" ErrorMessage="电话填写错误" ControlToValidate="TextBox4" Display="Dynamic" ValidationExpression="[0-9]{3,4}[-]{1}[0-9]{7,8}">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
传真:</td>
<td>
<asp:TextBox id="TextBox5" runat="server" Width="100px" MaxLength="13"></asp:TextBox>
<asp:RegularExpressionValidator id="RegularExpressionValidator5" runat="server" ErrorMessage="传真号码输入错误" ControlToValidate="TextBox5" Display="Dynamic" ValidationExpression="[0-9]{3,4}[-]{1}[0-9]{7,8}">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
联系人:</td>
<td>
<asp:TextBox id="TextBox6" runat="server" Width="100px" MaxLength="4"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator5" runat="server" ErrorMessage="联系人必须填写" ControlToValidate="TextBox6" Display="Dynamic">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
电子邮件:</td>
<td>
<asp:TextBox id="TextBox7" runat="server" Width="200px"></asp:TextBox>
<asp:RegularExpressionValidator id="RegularExpressionValidator2" runat="server" ErrorMessage="电子邮件地址错误" ControlToValidate="TextBox7" Display="Dynamic" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
网址:</td>
<td>
<asp:TextBox id="TextBox8" runat="server" Width="200px"></asp:TextBox>
<asp:RegularExpressionValidator id="RegularExpressionValidator3" runat="server" ErrorMessage="网址输入错误" ControlToValidate="TextBox8" Display="Dynamic" ValidationExpression="((http)://)?(((([\d]+\.)+){3}[\d]+(/[\w./]+)?)|([a-z]\w*((\.\w+)+){2,})([/][\w.~]*)*)">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
内容:</td>
<td>
<asp:TextBox id="TextBox9" runat="server" TextMode="MultiLine" Width="360px" Rows="8"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator6" runat="server" ErrorMessage="内容必须填写" ControlToValidate="TextBox9" Display="Dynamic">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button onclick="button_click" id="Button" runat="server" Text="提交"></asp:Button>
<asp:ValidationSummary id="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False"></asp:ValidationSummary>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
提示出错的语句是:cmd.executenonquery()
尝试无数次了,还是出错,盼高手指点。