|
-
May 8th, 2003, 08:52 AM
#1
Thread Starter
Frenzied Member
initializing variable
I have the code below in a module, but when I debug and check the value of strCon, the UserID and Password asre missing from the string, but when I put the cursor over origLogon and origPass they do have the correct values...how can I get the strCon variable to initilize?
thanks
VB Code:
Public strCon As String = "Provider=MSDAORA;Password=" & origPass & ";User ID=" & origLogon & ";Data Source=dbatest"
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
May 8th, 2003, 10:29 AM
#2
Looks fine to me. What data type are your origPass and origLogon variables? If they are strings then you shouldn't have a problem.
This world is not my home. I'm just passing through.
-
May 8th, 2003, 10:33 AM
#3
Thread Starter
Frenzied Member
VB Code:
Module Module2
Public origLogon As String
Public origPass As String
Public strCon As String = "Provider=MSDAORA;Password=origPass;User ID=origLogon;Data Source=dbatest"
Public objCon As New OleDbConnection(strCon)
Last edited by EyeTalion; May 8th, 2003 at 10:41 AM.
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
May 8th, 2003, 10:37 AM
#4
origLogon and origPass do not have values when strCon is populated. Thts why. It doesnt work the way you are thinking where if they are set later, that strcon is going to automatically change. Un uh. Doesnt do that.
-
May 8th, 2003, 10:39 AM
#5
Thread Starter
Frenzied Member
is there a way I can go back and initilize strCon after I get values for the userid and password?
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
May 8th, 2003, 10:43 AM
#6
yeah
strCon = "Provider=MSDAORA;Password=" & origPass & ";User ID=" & origLogon & ";Data Source=dbatest"
-
May 8th, 2003, 10:46 AM
#7
Thread Starter
Frenzied Member
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
May 8th, 2003, 11:03 AM
#8
whats confusing? You just set the variable again.
-
May 8th, 2003, 11:41 AM
#9
Sleep mode
If you can put your code in a class and build a constructor which is mainly created for intializing variables . Whenever you intantiate obj from this class , then you have to provide these two variables .
-
May 8th, 2003, 11:48 AM
#10
more work than necessary for something so simple.
-
May 8th, 2003, 12:05 PM
#11
Thread Starter
Frenzied Member
whats confusing? You just set the variable again.
but it's in my module, how do I call it?
wait, I think it's beginging to sink in...just set the variable again in the form instead of the module?
Last edited by EyeTalion; May 8th, 2003 at 12:31 PM.
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
May 8th, 2003, 12:45 PM
#12
Sleep mode
Cander is right but I thought of constructors as ideal option . strCon variable will hold the last value origLogon and origPass were set to ! It should work fine . And you can create two properties to set those two variables if you want .
-
May 9th, 2003, 04:25 AM
#13
Lively Member
Originally posted by Cander
more work than necessary for something so simple.
VB.NET is an OO language it should go in a class however simple.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|