Initializing a Public variable from code.

  • Thread starter Thread starter Manuel Canas
  • Start date Start date
M

Manuel Canas

Hi there,

I'm having this issue with my connection object.

I'm using a public variable for my DB connection.

It's straight forward;
Public conn As String = "data source=mycomputer\MSDE;initial catalog=DB" &
";" & _

"User ID=" & cUserName & ";" & _

"Password=" & cPassword

This first time I login correctly to my app, it works fine, but if I fail to
provide a valid username or a password, I get the SQL error, I clear the
connection object on the Catch conn = nothing.

Now how do I initialize this object again?

Thanks,

Manuel
 
Thanks,

My public variable is on a module. I know you said (Mary) to create a
procedure to initialize this variable. I know how to create procedures, but
for the love of God, I just don't know how to reinitialize this one.

Ay help would much Appreciated.

Manuel
 
Sorry for the delay in responding to you -- I was offline due to
Hurricane Frances. Create a procedure that takes the new value as an
argument (NewValue). Then set it:

MyPublicVariable = NewValue

--Mary
 
Back
Top