论坛: 编程破解 标题: vb问题各位大哥帮帮我 复制本贴地址    
作者: pizi [pizi]    论坛用户   登录
Public Function ExecuteSQL(ByValSQL As String,MsgString As String)_As ADODB.Recordset
'执行SQL语句,并返回记录集对象

cnn.Open ConnectString
  If InStr("INSERT,DELETE,UPDATE", UCase$(sTokens(0))) Then
      cnn.Execute SQL
      MsgString = sTokens(0) & "query successful"
  Else
      Set rst = New ADODO.Recordset
      rst.Open Trim$(SQL), cnn, adOpenKeyset, adLockOptimistic
      rst.MoveLast
      get RecordCount
  '返回记录集对象

Set ExecuteSQL = rst
        MsgString = "查询到"&rst.RecordCount&"条记录"
  End If
ExecuteSQL_Exit:
  Set rst = Nothing
  Set cnn = Nothing
  Exit Function
ExecuteSQL_Error:
  MsgString = "查询错误:" & Err.Description
  Resume ExecuteSQL_Exit
End Function

上面3段中其中的
Public Function ExecuteSQL(ByValSQL As String,MsgString As String)_As ADODB.Recordset

get RecordCount

MsgString = "查询到"&rst.RecordCount&"条记录"

有错误    谢谢帮我修改一下

地主 发表时间: 05-05-21 23:28

论坛: 编程破解

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号