各位大侠: 我用vb 做了一个工程 和 sql2000 连接的 
现在我把系统重新安装了一下(vb sql2000 和以前一样的)为什么运行时 不能连接数据库???
数据库 (服务器名 用户名 密码 数据库)全和原来一样?  能告诉我什么什么地方错了吗???

解决方案 »

  1.   

    1.检查连接语句参数是否正确
    2.数据库服务是否启动(SQLSERVER.EXE)
      

  2.   

    '''''module1.bas 里面 
    Public Function Connect1(ByVal c As ADODB.Connection)
      c.Open "driver=sql server;server=xxglserver;uid=sa;pwd=123;database=xxgl"
    End FunctionPublic Function Deconnect1(ByVal c As ADODB.Connection)
    c.Close
    Set c = Nothing
    End FunctionPublic Sub Main()
    Set frmMain = New frmspan    '启动对象
    frmMain.Show: frmMain.SetFocus
    End sub
    '''''frmspan  窗体代码
    Dim objconnection As ADODB.Connection
    Private Sub Form_Load()
    Label4.Caption = "正在联接数据库服务器,请稍侯······"
    On Error GoTo aaa
    Set objconnection = New ADODB.Connection
    Connect1 objconnection
    Randomize
    Timer1.Interval = 5000 + 10 * Rnd
    Exit Sub
    aaa:
    MsgBox "不能正确联接到数据库服务器,请与系统管理员联系!", vbExclamation, "系统信息"
    End
    End SubPrivate Sub Form_Unload(Cancel As Integer)
    Deconnect1 objconnection
    End SubPrivate Sub Timer1_Timer()
    Label4.Caption = "正 在 加 载 登 录 界 面"
    Label4.left = (Me.Width - Label4.Width) / 2
    Randomize
    Timer2.Interval = 1000 + 5 * Rnd
    End SubPrivate Sub Timer2_Timer()
    Unload Me
    frmlogon.Caption = "用户登录"
    frmlogon.Command3.Visible = False
    frmlogon.Command1.Visible = True
    frmlogon.Command4.Visible = False
    frmlogon.Command2.Visible = True
    frmlogon.Show
    frmlogon.SetFocus
    End Sub
      

  3.   

    主机名 xxglserver sql用户 sa 密码 123 数据库 xxgl
      

  4.   

    郁闷呀  身份验证时 选择了 仅windows 晕死 浪费时间!!!!