
网页制作投票系统时asp中update语句出错 10
错误类型:MicrosoftOLEDBProviderforODBCDrivers(0x80040E14)[Microsoft][ODBCMicrosoftAccessD...
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] UPDATE 语句的语法错误。
/we/2006010409532086924/vote_count.asp, 第 31 行
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_mydate_STRING
Recordset1.Source = "SELECT * FROM vote"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
set add = Server.CreateObject("ADODB.Command")
add.ActiveConnection = MM_mydate_STRING
add.CommandText = "update vote set " + Replace(add__string, "'", "''") + " = " + Replace(add__string, "'", "''") + " + 1"
add.CommandType = 1
add.CommandTimeout = 0
add.Prepared = true
add.Execute()
Response.Redirect("vote_show_vote2.asp")
%>
谢谢帮忙 展开
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] UPDATE 语句的语法错误。
/we/2006010409532086924/vote_count.asp, 第 31 行
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_mydate_STRING
Recordset1.Source = "SELECT * FROM vote"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
set add = Server.CreateObject("ADODB.Command")
add.ActiveConnection = MM_mydate_STRING
add.CommandText = "update vote set " + Replace(add__string, "'", "''") + " = " + Replace(add__string, "'", "''") + " + 1"
add.CommandType = 1
add.CommandTimeout = 0
add.Prepared = true
add.Execute()
Response.Redirect("vote_show_vote2.asp")
%>
谢谢帮忙 展开
1个回答
展开全部
add.CommandText = "update vote set " + Replace(add__string, "'", "''") + " = " + Replace(add__string, "'", "''") + " + 1"
怎么会有两个 " + Replace(add__string, "'", "''") + " 呢
第一个应该改为"+字段名+"
<%
set add = Server.CreateObject("ADODB.Command")
add.ActiveConnection = MM_mydate_STRING
add_string=Replace(add__string, "'", "''")
add_srring+=1
add.CommandText = "update vote set " + 字段名+ " = "+add_string+""
add.CommandType = 1
add.CommandTimeout = 0
add.Prepared = true
add.Execute()
Response.Redirect("vote_show_vote2.asp")
%>
怎么会有两个 " + Replace(add__string, "'", "''") + " 呢
第一个应该改为"+字段名+"
<%
set add = Server.CreateObject("ADODB.Command")
add.ActiveConnection = MM_mydate_STRING
add_string=Replace(add__string, "'", "''")
add_srring+=1
add.CommandText = "update vote set " + 字段名+ " = "+add_string+""
add.CommandType = 1
add.CommandTimeout = 0
add.Prepared = true
add.Execute()
Response.Redirect("vote_show_vote2.asp")
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询