行sql语句,且返回执行结果Р sql = Trim$(sql)Р Set conn = New ADODB.Connection '定义一个Connection对象Р Set rst = New ADODB.Recordset '定义一个Recordset对象Р conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db\teacher.mdb;Persist Security Info=False" '连接数据库的语句Р conn.OpenР Set rst.ActiveConnection = connР rst.LockType = adLockOptimisticР rst.CursorType = adOpenKeysetР rst.Open sql '执行Р Set exesql = rstР Set rst = NothingР Set conn = NothingРРEnd FunctionРPublic Sub deldata(ByVal tn As String) '删除指定表中所有记录Р Dim sql As StringР sql = "delete * from " & Trim$(tn)Р Set conn = New ADODB.Connection '同上Р conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db\teacher.mdb;Persist Security Info=False" '同上Р conn.OpenР conn.Execute sqlР Р conn.Close