a的值是a = .Text这个吧?

解决方案 »

  1.   

    做如下改动:
    第一:sql = "delete from book where text1= '"+a+"'" 
    第二:rs.Open sql, con, adOpenStatic, adLockOptimistic
      

  2.   

    在MSDN的索引中输入 Open method (ADO Recordset)
    看看数据库打开时参数如何设置。 你设置 adOpenKeyset, adLockOptimistic是不能用rs.RecordCount的。
      

  3.   

    With vaSpread1
        .Col = 1
        .Row = .ActiveRow
      sql = "delete from book where text1='"& .Text &"'" 
     End With
      这个地方a没有值呀为什么?if rs.state=0 then
      msgbox"没有最大值",,""
      exit sub
     endif.MaxRows = rs.RecordCount    这个地方告诉我对象关闭,不允许执行应用程序的操作
    ?? 是不是这两个问题
      

  4.   

    a 你把a 当成字符串了

    sql = "delete from book where text1= '"& a &"'"
      

  5.   

    .MaxRows = rs.RecordCount    这个地方告诉我对象关闭,不允许执行应用程序的操作
    还是不行呀
      

  6.   

    上面是你的全部代码吗?
    如果你的数据库没有关闭,就是你的con就没有连上数据库
    把你的con连接代码贴出来看看。
      

  7.   

    if con.state=0 then
      con.open
     endifif rs.state=1 then
       rs.state=0
      endif
    rs.Open sql, con, adOpenKeyset, adLockOptimistic
    '    Command5_Click
    With vaSpread1
        .Col = -1
        .Row = .ActiveRow
        .Text = ""
        .MaxRows = rs.RecordCount    这个地方告诉我对象关闭,不允许执行应用程序的操作
    End With
      

  8.   

    if con.state=0 then
       con.open
    endif
    if rs.state=1 then
       rs.close
    endif
      

  9.   

    Dim rs As New ADODB.Recordset应该在通用中声明,否则在Command5_Click
    时就没有rs了。
      

  10.   

    你的sql语句要改一下~!!!应写成这样:sql = "delete from book where text1= '" & a & "'"至于第二个问题你用的是第三方控件,你应该再仔细阅读一下它的使用说明…!!!