ASP动态网站留言板里的错误!请高手帮下忙……

ousicong440 2009-06-14 11:58:24
我网站里面的一个留言板出现的问题。我是用“自定义连接字符串”来绑定我的ACCESS数据库的!每次我在留言板写好东西提交时,就会弹出如下的错误报告。请高手帮忙下…… (或请高手们给我一个留言板的做法或者代码)

一、弹出问题信息如下:
Microsoft JET Database Engine '80040e07'

标准表达式中数据类型不匹配。

\wwwroot\laoke\liuyan.asp, line 115


二、代码如下:

<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute ‘这就是115行
MM_editCmd.ActiveConnection.Close ’这就是116行

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
Dim RS
Dim RS_numRows

Set RS = Server.CreateObject("ADODB.Recordset")
RS.ActiveConnection = MM_conn_STRING
RS.Source = "SELECT * FROM msg"
RS.CursorType = 0
RS.CursorLocation = 2
RS.LockType = 1
RS.Open()

RS_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 3
Repeat1__index = 0
RS_numRows = RS_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim RS_total
Dim RS_first
Dim RS_last

' set the record count
RS_total = RS.RecordCount

' set the number of rows displayed on this page
If (RS_numRows < 0) Then
RS_numRows = RS_total
Elseif (RS_numRows = 0) Then
RS_numRows = 1
End If

' set the first and last displayed record
RS_first = 1
RS_last = RS_first + RS_numRows - 1

' if we have the correct record count, check the other stats
If (RS_total <> -1) Then
If (RS_first > RS_total) Then
RS_first = RS_total
End If
If (RS_last > RS_total) Then
RS_last = RS_total
End If
If (RS_numRows > RS_total) Then
RS_numRows = RS_total
End If
End If
%>
...全文
57 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
oulin1983 2009-06-15
  • 打赏
  • 举报
回复
标准表达式中数据类型不匹配。
一般就是写入数据库的数据类型与数据库设置的字段类型不符合造成的
请检查你的sql语句
字符型
sql="select * from table where id='"&id&"'"
数字型
sql="select * from table where id="&id&""
lihan6415151528 2009-06-14
  • 打赏
  • 举报
回复
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

改成

MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values ('" & MM_dbValues & "')"
ziyuanxian 2009-06-14
  • 打赏
  • 举报
回复
数据类型不匹配
就是说你把文体写入了数字字段了。改数据库字段类型比较快点
要么把文件格式转化为数据类型
啊_sdf12 2009-06-14
  • 打赏
  • 举报
回复
这分明就没改么。

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧