这样:adoRS.Open ("select count(I_id) as c from inputrp")

解决方案 »

  1.   

    adoRS.Open "select count(I_id) as c from inputrp",cn
      

  2.   

    不用别名呢?
    Private Sub SetInputID() '设置商品ID号
      
      adoRS.Open ("select count(I_id) from inputrp")
      RowsInTable = adoRS.Fields(0)
      IID = "I" & Format(RowsInTable + 1, "000000000")
      txtinputID.Text = IID
      adoRS.Close
        
    End Sub
      

  3.   

    Private Sub SetInputID() '设置商品ID号
      
      adoRS.Open "select count(I_id) as c from inputrp",cn
      if not adors.eof then
        RowsInTable = adoRS.Fields("c")
        IID = "I" & Format(RowsInTable + 1, "000000000")
        txtinputID.Text = IID
      else
       '....
      end if
      adoRS.Close
        
    End Sub
      

  4.   

    '补充一点Private Sub SetInputID() '设置商品ID号
      
      adoRS.Open "select count(I_id) as c from inputrp",cn
      if not adors.eof then
         if isNull(adoRS.Fields("c")) then
            RowsInTable=""
         else
            RowsInTable = adoRS.Fields("c")
         end if
         
        IID = "I" & Format(RowsInTable + 1, "000000000")
        txtinputID.Text = IID
      else
       '....
      end if
      adoRS.Close
        
    End Sub