添加数据出现了问题
add2.asp<%@ LANGUAGE="VBScript" %><html>
<head>
<script language="VBScript">
<!--
Sub reg_OnClick
Dim msg, datas
msg = "" : datas = ""
For Each tbox In fset.elements
If tbox.name = "reg" Then Exit For
If Left(tbox.name, 2) = "cz" Then
If tbox.value = "" Then
msg = "充值金额不能为空!请修改..."
ElseIf Not IsNumeric(tbox.value) Then
msg = "充值金额由数字组成!请修改..."
ElseIF CInt(tbox.value) > 100 Or CInt(tbox.value) < 0 Then
msg = "一次充值金额应该在[0-100]之间!请修改..."
End If
If msg <> "" Then
Alert(msg)
tbox.focus
Exit Sub
End If
datas = datas & ";" & Right("00" & tbox.value,3)
Else
datas = datas & tbox.value
End if
Next
freg.datas.value = Mid(datas,2)
freg.submit
End Sub
-->
</script>
</head>
<body>
<center>
<form name="fset">
<%
Sub ShowTextBox(tbname, i, tbmaxlen)
Response.Write("<td><input type=text size=16")
Response.Write(" name=" & tbname & i)
Response.Write(" maxlength=" & tbmaxlen)
Response.Write("></td>")
End Sub
Sub ShowHeader(tabletitle)
Response.Write("<p>【<b>" & tabletitle & "</b>】")
Response.Write("<table border='1' width='80%'>")
Response.Write("<tr align='left'>")
Response.Write("<th width='25%'>会员账号</th>")
Response.Write("<th width='25%'>球队编号</th>")
Response.Write("<th width='25%'>充值金额</th>")
Response.Write("<th width='25%'>备注</th>")
Response.Write("</tr>")
End Sub
Dim zh, lb, qs1, qs2, msg, hyzhs
zh = Request("hyzh")
lm = Request("qilm")
qs1 = False : qs2 = False : msg = ""
if zh <> "" and lm <> "" then
mysql = "SELECT jine.会员账号,team.球队名称,jine.充值金额,jine.备注 " & _
" FROM jine " & _
" INNER JOIN team ON jine.球队编号= team.球队编号 " & _
" WHERE 会员账号 LIKE '%" & Request("hyzh") & "%'" & _
" AND team.球队编号 = '" & Left(Request("qmlm"),3) & "'"
elseif zh <> "" and lm = "" then
mysql = "SELECT jine.会员账号,team.球队名称,jine.充值金额,jine.备注 " & _
" FROM jine " & _
" INNER JOIN team ON jine.球队编号= team.球队编号 " & _
" WHERE 会员账号 LIKE '%" & Request("hyzh") & "%'"
else
mysql = "SELECT jine.会员账号,team.球队名称,jine.充值金额,jine.备注 " & _
" FROM jine " & _
" INNER JOIN team ON jine.球队编号= team.球队编号 " & _
" WHERE team.球队编号 = '" & Left(Request("qmlm"),3) & "'"
end if
Set objRS = Session("objRS")
objRS.Source = mysql
objRS.Open
If objRS.RecordCount > 0 Then
Call ShowHeader("已经充值的会员")
Do While Not objRS.EOF
Response.Write("<tr>")
Response.Write("<td>" & objRS("会员账号") & "</td>")
Response.Write("<td>" & objRS("球队名称") & "</td>")
Response.Write("<td>" & objRS("充值金额") & "</td>")
Response.Write("<td>" & objRS("备注") & " </td>")
Response.Write("</tr>")
objRS.MoveNext
Loop
Response.Write("</table>")
qs1 = True
End If
objRS.Close
' 注释:显示可新增成绩信息的记录
mysql = "SELECT 会员账号,球迷联盟 FROM main " & _
"WHERE 会员账号 LIKE '%" & zh & "%' " & _
"AND 会员账号 NOT IN (" & _
"SELECT 会员账号 FROM jine " & _
"WHERE 会员账号 LIKE '%" & zh & "%' " & _
"AND 球队编号 = '" & lm & "'" & _
")"
objRS.Source = mysql
objRS.Open
' 注释:显示相关的记录
hyzhs = ""
If objRS.RecordCount > 0 Then
Call ShowHeader("会员充值登记表")
For i = 1 To objRS.RecordCount
Response.Write("<tr>")
Response.Write("<td>" & objRS("会员账号") & "</td>")
Response.Write("<td>" & objRS("球迷联盟") & "</td>")
Call ShowTextBox("cz", i,5)
Call ShowTextBox("bz", i, 50)
Response.Write("</tr>")
hyzhs = hyzhs & ";" & objRS("会员账号")
objRS.MoveNext
Next
Response.Write("</table>")
qs2 = True
hyzhs = Mid(hyzhs,2)
End If
' 注释:显示相关信息
If Not qs1 And Not qs2 Then msg = "数据库中没有当前会员的记录!"
If qs1 And Not qs2 Then msg = "当前会员已经充值了!"
If msg = "" Then
Response.Write("<p><hr>")
Response.Write("<input name=reg type=button value=提交金额> ")
Response.Write("<input type=reset value=重填数据>")
Else
Response.Write("<p><font color=red>" & msg & "</font>")
End if
' 注释:关闭记录集
objRS.Close
Set objRS = Nothing
%>
</form>
<form name="freg" action="add3.asp" method="post" target="add2">
<INPUT name="hyzhs" type="hidden" value="<% =zh %>">
<INPUT name="datas" type="hidden">
<INPUT name="qmlm" type="hidden" value="<% =lm%>">
</form>
</center>
</body>
</html>
add3.文件<%@ LANGUAGE="VBScript" %>
<html>
<head></head>
<body>
<center>
<%
Dim hyzhs, datas,hyzh, qmlm, jine, note, i
hyzhs = Split(Request("hyzhs"), ";")
datas = Split(Request("datas"), ";")
qmlm = left(Request("qmlm"),3)
' 注释:连接数据库
Set objConn = Session("objConn")
i = 0
For Each hyzh In hyzhs
jine = Left(datas(i),3)
note = mid(datas(i),4)
mysql = "INSERT INTO jine " & _
"VALUES " & _
"( '" & hyzh & "','" & qmlm & "','" & jine & "','" & note & "')"
objConn.Execute mysql
i = i + 1
Next
' 注释:显示操作结果
Response.Write("本次操作成功添加了【" & i & "】条成绩记录!")
%>
</center>
</body>
</html>
点击提交数据后显示的错误信息是“错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] 操作必须使用一个可更新的查询。
/xiaolaba3330/add3.asp, 第 20 行
”