VB.NET App Connect to Oracle 9i Login Screen Parameters

Posted on 2007-10-08
Last Modified: 2013-12-19
Hi All,
I'm hoping that this is a dumb question but it's just one I can't find the answer to.  I've developed an application with Visualt Studio 2003 in VB that connects to an oracle 9i DB but the User/PW is imbedded in the application properties.  This of course breaks that rules at my company and I must remove the hard coded User/PW from the programs connection string.  

Can someone point me in the correct direction of how to setup a LogIn page for the application i.e. how do I assign the User/PW dynamically when the app starts.  I can certainly create the page I just dont know how to assing the proper variables on a login page.

Question by:rwkuhnle
    LVL 15

    Expert Comment

    you need to take the strings that the user enters on the login form and insert them into the connection string. You could do something simple like change the connectionstring by replacing the username and password with #USER and #PASS then in the login form replace those with the entered values

    dim connectionstring = <get connectionstring>

    dim actualconnectionstring = connectionstring.Replace("#USER", username.Text).Replace("#PASS", password.Text)

    then use actualconnectionstring for your connection

    Author Comment

    Exactly what I do need to do but I don't know where in a VB.NET app to actually assign those value.  I presume there is some underlying form or module that the system is managing that I have yet to physically work with that needs to be passed those parameters in order to populate the connection string with the UID/PW values.  That's the part that I really need :-)
    LVL 15

    Accepted Solution

    you could have a shared string somewhere that you use for the connection string

    public class Form1
       public shared MyConnStr as String

    then when the user clicks ok for the login details you could do
    dim connectionstring = <get connectionstring>
    MyConnStr = connectionstring.Replace("#USER", username.Text).Replace("#PASS", password.Text)

    then whereever you use the connection string use Form1.MyConnStr instead

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Introduction A previously published article on Experts Exchange ("Joins in Oracle", makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
    Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
    This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now