Error '3709:The connection cannot be used to perform this operation.It is either closed or invalid in this context.

  • I get this problem when i install the system into new PC . The old PC is OK. When i try to login to the system, this error come out 'Error '3709:The connection cannot be used to perform this operation.It is either closed or invalid in this context.'. I already install MDAC 2.0 but still got problem. I develop this system using VB6 and database SQL Server 2005. Can u help me?.

  • We need a little more information.

    What is "the system"?

    What is the new operating system?

    What is the old operating system?

    What is the operation you are trying to perform?

    Can you post the code that is performing the operation? Or at least some form of it.

  • The system is plant management system. Our team developed this system using VB6.This client-server system.Client have to login to logon this system.The client cannot login because that error.

    The new and old PC using same OS windows xp sp2.

    Below the code for the login screen.

    Public Function OpenConnection() As Boolean

    On Error Resume Next

    Err.Clear

    OpenConnection = True

    If cn Is Nothing Then

    Set cn = New ADODB.Connection

    With cn

    '.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa; Password=azhar;Initial Catalog=myPLANT;Data Source=SQLSERVER"

    .ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=" & sUserName & "; Password=" & sPassword & ";Initial Catalog=dummies;Data Source=" & sServer

    .Open

    End With

    If cn.Errors.Count > 0 Then

    MsgBox "SQL Server does not exist or acess denied. Please contact your administrator to get assist.", vbOKOnly + vbCritical, "myPLANT™:Database Connection"

    'DispErrors

    cn.Close

    OpenConnection = False

    Set cn = Nothing

    End If

    End If

    End Function

    Public Sub getConnected()

    Set cn = New ADODB.Connection

    With cn

    ' .ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa; Password=azhar;Initial Catalog=myPLANT;Data Source=SQLSERVER"

    .ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=" & sUserName & "; Password=" & sPassword & ";Initial Catalog=dummies;Data Source=" & sServer

    .Open

    End With

    End Sub

    Public Sub ConnectionClose()

    On Error Resume Next

    cn.Close

    Set cn = Nothing

    On Error GoTo 0

    End Sub

    Public Sub closeDB()

    rs.Close

    Set rs = Nothing

    cn.Close

    Set cn = Nothing

    End Sub

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply