c# - My connection class doesn't read inputs values? -


i have below classes , 1 mainform. want user login inputs , connect oracle database. when track in debugging mode user inputs not assigned getters , setters so, when called helper class connect database null values passing connection string inside connection class... , can not access database. doing wrong?

you don't set values.

this:

accessorclass s = new accessorclass();  ... = connectionclass.connection(s.db, s.id, s.password);                                 //  ^^   ^^    ^^^^^^^^^ - no values in these 

use initialization list set them:

accessorclass s = new accessorclass() { db = "database", id = "id", password = "password" }; 

edit:

your update won't work either. you're creating accessorclass object, calling method. in method.. you're new'ing accessorclass. this:

accessorclass s = new accessorclass ();     s.db = txtdatabase.text; s.id = txtid.text; s.password = txtpassword.text;  helperclass.get(s); // <--- pass instance through 

then change helperclass.get function this:

public static void get(accessorclass s)     {         // removed: accessorclass s = new accessorclass();                        oracleconnection conn = connectionclass.connection(s.db, s.id, s.password); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -