rst.open "select * from sb" if rst.eof then msgbox "没有记录"
Private Sub Form_Load() Dim conn As New ADODB.Connection Dim Rst As New ADODB.Recordset Dim strSQL As String conn.ConnectionString = "...." conn.OpenstrSQL = "Select * from sb" Rst.Open strSQL, conn, adOpenDynamic, adLockReadOnly If Rst.EOF Then MsgBox "没有记录" Rst.Close conn.Close Set Rst = Nothing Set conn = NothingEnd Sub
if rst.eof then msgbox "没有记录"
Dim conn As New ADODB.Connection
Dim Rst As New ADODB.Recordset
Dim strSQL As String
conn.ConnectionString = "...."
conn.OpenstrSQL = "Select * from sb"
Rst.Open strSQL, conn, adOpenDynamic, adLockReadOnly
If Rst.EOF Then MsgBox "没有记录"
Rst.Close
conn.Close
Set Rst = Nothing
Set conn = NothingEnd Sub