insert into语法错误,请教各位师傅!
hp21c 2003-10-15 11:21:30 <%@import namespace="system.data.oledb"%>
<%@import namespace="system.data"%>
<%@ Page Language="vb" explicit="true" debug="true"%>
<script runat="server">
sub page_load(sender As Object,e As EventArgs)
if Page.IsPostBack then
InsertRecord()
End If
End Sub
Sub InsertRecord()
dim conClasf As OleDbConnection
dim cmdClasf As New OleDbCommand
dim strClasf As string
dim strSQL As String
dim intRowsAff As Integer
strclasf="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & _
server.mappath("double_m.mdb") & ";"
conClasf=New OleDbConnection(strClasf)
conClasf.Open
strSQL="INSERT INTO double (" & _
"situ," & _
"workplan," & _
"beizhu," & _
")VALUES('" & _
Replace(situid.Value,"'","''") & _
"','" & _
Replace(workplanid.Value,"'","''") & _
"','" & _
Replace(beizhuid.Value,"'","''") & _
"')"
cmdClasf=New OledbCommand(strSQL,conClasf)
Try
intRowsAff=cmdClasf.ExecuteNonQuery()
Catch ex as exception
warnid.text=ex.Message
end try
rowsAffid.text=intRowsAff & "record(s) inserted"
conClasf.Close
End Sub
</script>
<html>
<head>
<title>双月工作情况</title>
</head>
<body>
<h1 align="center">双月工作情况</h1>
<form method="post" runat="server">
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" width="80%" id="AutoNumber1" height="494">
<tr>
<td width="18%" height="207"><font size="2">双月工作情况</font></td>
<td width="82%" height="207">
<textarea id="situid" rows="16" cols="85" runat="server"></textarea></td>
</tr>
<tr>
<td width="18%" height="210"><font size="2">下步工作计划</font></td>
<td width="82%" height="210">
<textarea id="workplanid" rows="16" cols="85" runat="server"></textarea></td>
</tr>
<tr>
<td width="18%" height="75"><font size="2">备注</font></td>
<td width="82%" height="75">
<textarea id="beizhuid" rows="6" cols="85" runat="server"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="确认" id="btnSub" runat="server"/></td>
</table>
</center>
</div>
</form>
<p><asp:label id="tbrid" runat="server"/></p>
<p><asp:label id="dateid" runat="server"/></p>
<p><asp:label id="rowsAffid" runat="server"/></p>
<p><asp:label id="warnid" runat="server"/></p>
</body>
</html>