here a piece of vb code where i have a problem:

        If G_ObjConnectionTemp.State = ConnectionState.Closed Then
        End If
        ' at this stage the connection is verified to be open
        Dim Obj_CommandF As New OleDbCommand("delete from ficheclient", G_ObjConnectionTemp)
        Using G_ObjConnectionTemp
        End Using
        Dim xx = G_ObjConnectionTemp.State.ToString
       ' at this stage however the connection is found to be closed Why?

Recommended Answers

All 2 Replies

The Using statement will close and dispose the object when it reaches the end of the using block.

You should just call


Without the using statement. It is not needed.

Also a note is that the command given has no qualifiers therefore will clear the whole table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.