古诗两首赠刘景文:[Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: \',\' 附近有语法错误。

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/14 01:07:44
这个错误是我升级数据库出现地.从Access到SQL
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: ',' 附近有语法错误。
/jjclass/www/teacher/interact/bbs/re_add.asp, 第 56 行
对应代码:
<% response.buffer=true%>
<!--#INCLUDE FILE="../../../system/odbc_clongshanion4.asp"-->
<%
dim board_id,subject_id
board_id=request("board_id")
subject_id=request("subject_id")

dim title,body,layer,parent_id,child,hits,length,ip,user_id,user_name,user_type
title=request.form("title")
body=request.form("body")
layer=2
parent_id=request("announce_id") '因为是回复文章,所以用annouce_iD
child=0
hits=0
length=len(body)
ip=request.servervariables("REMOTE_ADDR")
user_id=session("user_id")
user_name=session("user_name")
user_email=session("user_email")
user_type=session("user_type")

Dim SQL,sValues
SQL = "Insert into bbs(board_id"
sValues = "values(" & board_id
SQL = SQL & ",subject_id"
sValues = sValues & "," & subject_id
SQL = SQL & ",title"
sValues = sValues & "," & "'" & title & "'"
If body<>"" Then
SQL = SQL & ",body"
sValues = sValues & "," & "'" & body & "'"
End If
SQL = SQL & ",layer"
sValues = sValues & "," & layer
SQL = SQL & ",parent_id"
sValues = sValues & "," & parent_id
SQL = SQL & ",child"
sValues = sValues & "," & child
SQL = SQL & ",hits"
sValues = sValues & "," & hits
SQL = SQL & ",length"
sValues = sValues & "," & length
SQL = SQL & ",ip"
sValues = sValues & ",'" & ip & "'"
SQL = SQL & ",user_id"
sValues = sValues & "," & "'" & user_id & "'"
SQL = SQL & ",user_name"
sValues = sValues & "," & "'" & user_name & "'"
SQL = SQL & ",user_type"
sValues = sValues & "," & "'" & user_type & "'"
SQL = SQL & ",submit_date"
sValues = sValues & "," & "'" & date & "'"
'SQL = SQL & ",user_email"
'sValues = sValues & "," & "'" & user_email & "'"
SQL = SQL& ") " & sValues & ")"
db.Execute(SQL)
'回复数加 1
sql="update bbs set child=child+1 where announce_id=" & parent_id
db.execute(sql)

db.close
set db=nothing
response.redirect "right.asp?board_id=" & board_id & "&subject_id=" & subject_id

%>
我考虑了能够想地所有方面,但是还是没法解决.希望有高手帮我,不胜感激.
不论能够解决,先谢过
<%
Dim db
Set db=Server.CreateObject("ADODB.Connection")
db.Open "DRIVER={SQL SERVER};SERVER=(local);UID=sa;PWD=564544; DATABASE=jjclass"
function convert_date(thedate)
convert_date=year(thedate) & "-" & month(thedate) & "-" & day(thedate)
end function
%>
就是后面关于date这些,是不是有错 ?我不懂.

是odbc_clongshanion4.asp文件中数据库的问题
odbc_clongshanion4.asp帖出来吧!
------------------------------------------------
在 db.Execute(SQL) 前面加上
response.write SQL
response.end
看看SQL语句有没有问题
------------------------------------------------
如果是这样,那么肯定是 odbc_clongshanion4.asp 中的问题了,有可能在打开数据库时候出的错误!
要是不麻烦,就帖出来,或者发到我的油箱:
leewycyp@yahoo.com.cn