A CLASS OF DB BY ASP

来源:互联网 发布:珠穆朗玛软件下载 编辑:程序博客网 时间:2024/05/17 20:31

<%

  CLASS DB
 
    Private conStr,asqlStr
 
    Public Property Let ConnectStr(byval aValue)
      conStr=aValue
    End Property
 
 
 
    Public Property Get ConnectStr()
      ConnectStr=conStr
    End Property 

 

    Public Property Let sqlStr(byval aValue)
      asqlStr=aValue
    End Property
 
 
 
    Public Property Get sqlStr()
      sqlStr=asqlStr
    End Property 
       
       
 Public Function GetRecords()
   dim Conn,Cmd
   SET Conn=Server.CreateObject("Adodb.Connection")
   SET Cmd=Server.CreateObject("Adodb.Command")
  
   On Error Resume Next
  
   Conn.Open conStr
   Cmd.CommandText=asqlStr
   Cmd.ActiveConnection=Conn
   Conn.CursorLocation=3
   Conn.BeginTrans
  
   SET GetRecords=Cmd.Execute()  //Dont return a Record
  
   if Err.Number=0 then
         Conn.CommitTrans
      else
         Conn.RollbackTrans
      end if
 End Function

 End CLASS


%>