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
Post a Comment