打印本文 打印本文 关闭窗口 关闭窗口
面向对象的asp编程之五--adodb的类封装
作者:武汉SEO闵涛  文章来源:敏韬网  点击数2017  更新时间:2009/4/23 10:47:19  文章录入:mintao  责任编辑:mintao
sp;  end if 
     
   End Sub
   
  ''''--------------------------------------------------------------- 
  Public Sub CloseRecordSet()
         if objAdoRecordSet.State=1 then
            objAdoRecordSet.Close
         end if
  End Sub
 
  Public Sub SetConnection(objConnection)
         set objAdoConnection=objConnection
         set objAdoCommand.ActiveConnection = objAdoConnection     
  End Sub
 
  Public Sub OpenRecordSet(byval sql)
           CloseRecordSet()
           objAdoCommand.CommandText=sql
           set objAdoRecordSet=objAdoCommand.Execute()
  End Sub
 
  Public Sub OpenRecordSet2(sql,conn,CursorType,LockType)
         CloseRecordSet()
         objAdoRecordSet.Open sql,conn,CursorType,LockType
  End Sub
 
  Public Sub cmdExecute(byval sql)
         objAdoCommand.CommandText=sql
         objAdoCommand.Execute()
  End Sub
 
  ''''---------------------------------------------------------------
  Public Function GetFieldValue(byval fieldName)
         GetFieldValue=objAdoRecordSet(fieldName).Value
  End Function
 
  Public Function GetFieldName(byval fieldOrder)
         GetFieldName=objAdoRecordSet(fieldOrder).name
  End Function
 
  Public Function SetFieldValue(fieldName,fieldValue)
         objAdoRecordSet(fieldName).Value=fieldValue
  End Function
 
  Public Function GetBinaryField(fieldName)
 
  End Function
 
  Public Function SetBinaryField(fieldName,fieldValue)
 
  End Function
 
  Public Function RsUpDate()
         objAdoRecordSet.Update
  End Function
 
  Public Function GetRecordSet()
       set GetRecordSet=objAdoRecordSet
  End Function
  ''''---------------------------------------------------------------
  Function IsEmpty()
        IsEmpty=(objAdoRecordSet.BOF and objAdoRecordSet.EOF)
  End Function
 
  Function IsEof()
       IsEof=objAdoRecordSet.EOF
  End Function
 
  Function IsBof()
       IsBof=objAdoRecordSet.BOF
  End Function
 
  ''''---------------------------------------------------------------
  Function MoveFirst()
       objAdoRecordSet.MoveFirst
  End Function
 
   Function MovePrevious()
       if (not objAdoRecordSet.BOF) then
           objAdoRecordSet.MovePrevious
       end if   
  End Function
 
  Function MoveNext()
      if (not objAdoRecordSet.BOF) then
          objAdoRecordSet.MoveNext
      end if    
  End Function
 
   Function MoveLast()
       objAdoRecordSet.MoveLast
  End Function
 
End Class
''''#################################################################
Function CreateCAdoCommand()
         set CreateCAdoCommand=new  CAdoCommand 
End Function
Class CAdoCommand
 
   Public objAdoCommand
  
   ''''==============================================================
   Public Property Get cmdCommandType
           cmdCommandType=objAdoCommand.CommandType
   End Property

   Public Property Let cmdCommandType(ByVal cmdType)
           objAdoCommand.CommandType=cmdType
   End Property
 
  ''''===============================================================
    
   Private Sub Class_Initialize   '''' Setup Initialize event.

          set  objAdoCommand=Server.CreateObject("ADODB.Command")
          objAdoCommand.CommandType = 1
    
   End Sub
   Private Sub Class_Terminate   '''' Setup Terminate event.

          set objAdoCommand=nothing
     
   End Sub
  
   Public Sub cmdExecute()
 
   End Sub
    
End Class

</Script>

上一页  [1] [2] 

打印本文 打印本文 关闭窗口 关闭窗口