www.pudn.com > 2005.rar > Module1.bas, change:2007-06-25,size:569b


Attribute VB_Name = "Module1" 
Public adocon As New ADODB.Connection 
Public adocon_str As String 
Public fMainForm As frmMain 
 
 
Sub Main() 
    Form1.Show 
End Sub 
 
Public Function open_db() As Boolean '打开数据库 
    Set adocon = New ADODB.Connection 
    adocon_str = "driver={sql server};server=JUJUMAO;database=cheliang1" '创建连接 
    adocon.Open adocon_str 
    open_db = True 
End Function 
 
Public Function close_db() As Boolean '关闭打开数据库 
   If adocon.State = adStateOpen Then 
      adocon.Close 
   End If 
     close_db = True 
End Function