ChristianBG


I have a class that creates an oracle connection to a database that is compiled code and works fine. i pass an oracleconnection object back to the calling program and it uses it perfectly, until the code fully runs and it is time fo ruser imput and a form shows.

the user does what ever he does then a query is launched that uses the conneciton object again and all of a sudden it is closed. I am not sure i under stand how that happens. when i put a watch on it you can see that the string stays in place until the user clicks on the combobox. right when the program enters the code the connectionstring is gone




Re: OracleConnection Scope

Spidermans_DarkSide - VSIP


ChristianBG wrote:

I have a class that creates an oracle connection to a database that is compiled code and works fine. i pass an oracleconnection object back to the calling program and it uses it perfectly, until the code fully runs and it is time fo ruser imput and a form shows.

the user does what ever he does then a query is launched that uses the conneciton object again and all of a sudden it is closed. I am not sure i under stand how that happens. when i put a watch on it you can see that the string stays in place until the user clicks on the combobox. right when the program enters the code the connectionstring is gone

Hi,

Try a GLOBAL declaration so that the connection string is 'seen' by all the Subs.

E.G.

Code Snippet

'This is a GLOBAL variable declaration at the top or above all the Subs ( subroutines ).

Dim myConnectionString As String = "Whatever it is!! :-)"

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

End Sub

Regards,

S_DS