| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 537 人关注过本帖
标题:添加数据出现了问题
只看楼主 加入收藏
xiaolaba3330
Rank: 1
来 自:辽宁大连
等 级:新手上路
帖 子:175
专家分:0
注 册:2007-10-19
结帖率:100%
收藏
 问题点数:0 回复次数:2 
添加数据出现了问题
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("备注") & "&nbsp;</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=提交金额>&nbsp;")
         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 行
搜索更多相关主题的帖子: 数据 
2008-06-20 12:59
dhdhzzw
Rank: 1
等 级:新手上路
帖 子:949
专家分:0
注 册:2007-8-13
收藏
得分:0 
数据库目录文件夹---右键--属性--安全--加入everyone的修改权限,(事实上加iwam的修改权限就可以)
2008-06-20 13:54
xiaolaba3330
Rank: 1
来 自:辽宁大连
等 级:新手上路
帖 子:175
专家分:0
注 册:2007-10-19
收藏
得分:0 
呵呵 好了 ,谢谢~~~~~

编程学习中~~
2008-06-20 15:43
快速回复:添加数据出现了问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020162 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved