mysql - Using string from public static void in private bool C# -
so trying validate string received mysql database reason cannot access. sure dumb question can help me out? sense might related public vs private , static after playing around every combination can think of pass through variables, still keeps giving me errors. ideas?
string failreason = ""; int valid = 0; public static void getnewrow() { seek { string getnewrow = "select * appointments valid null"; dbconnection mysqldb = new dbconnection(); mysqlcommand mysqlcommand = new mysqlcommand(getnewrow, mysqldb.getlocalmysqlconnection()); mysqldatareader reader = mysqlcommand.executereader(); while (reader.read()) { int id = reader.getint32("id"); string accountid = reader.getstring("accountid"); string appdate = reader.getstring("appdate"); string apptime = reader.getstring("apptime"); string patientname = reader.getstring("patientname"); string appphone = reader.getstring("appphone"); string appphone2 = reader.getstring("appphone2"); string smsphone = reader.getstring("smsphone"); string special = reader.getstring("special"); string email = reader.getstring("email"); string provider = reader.getstring("provider"); string location = reader.getstring("location"); string other = reader.getstring("other"); console.writeline("id: " + id); console.writeline("accountid: " + accountid); console.writeline("appointment date: " + appdate); console.writeline("appointment time: " + apptime); console.writeline("patient name: " + patientname); console.writeline("phone 1: " + appphone); console.writeline("phone 2: " + appphone2); console.writeline("sms phone: " + smsphone); console.writeline("special: " + special); console.writeline("email: " + email); console.writeline("provider: " + provider); console.writeline("location: " + location); console.writeline("other: " + other); } } grab (exception ex) { console.writeline(ex.innerexception); } } private bool validname() { if (patientname.length < 20) { failreason = "bad name"; homecoming false; } else { homecoming true; } } private bool validname() { if (patientname.length < 20) { failreason = "bad name"; homecoming false; } else { homecoming true; } }
patientname exists within scope of getnewrow. need create class-scoped variable (like did failreason if want utilize them anywhere outside of getnewrow. can pass them parameters, don't see methods have parameters begin with.
c# mysql
No comments:
Post a Comment