//public string ID_Select(string Idtext) //{ // string i = "."; // MySql my = new MySql(); // string sql = string.Format("select passwod from signup where id = '{0}';", Idtext); // MySqlDataReader sdr = my.Reader(sql); // while (sdr.Read()) // { // i = sdr.GetValue(0).ToString(); // } // return i; //} public string PW_Select(string id) { string p = "."; string sql; MySql my = new MySql(); sql = string.Format("select passwod from signup where id = '{0}';", id); MySqlDataReader sdr = my.Reader(sql); while (sdr.Read()) { p = sdr.GetValue(0).ToString(); } return(p); }
public string PW_Select(string PWtext, string user_number) { string p = "."; string sql; MySql my = new MySql(); sql = string.Format("select passwod from signup where passwod = '{0}' && user_number = {1};", PWtext, user_number); MySqlDataReader sdr = my.Reader(sql); while (sdr.Read()) { p = sdr.GetValue(0).ToString(); } return(p); }
public bool ID_Pass_Select(string Idtext, string PWtext) { try { string i = "."; MySql my = new MySql(); string sql = string.Format("select user_number from signup where id = '{0}' && passwod = {1};", Idtext, PWtext); MySqlDataReader sdr = my.Reader(sql); while (sdr.Read()) { i = sdr.GetValue(0).ToString(); } return(true); } catch { return(false); } }
public ArrayList RankSelect() { MySql my = new MySql(); string sql = "SELECT member_rank FROM signup"; MySqlDataReader sdr = my.Reader(sql); //string result = ""; ArrayList list = new ArrayList(); while (sdr.Read()) { Hashtable ht = new Hashtable(); for (int i = 0; i < sdr.FieldCount; i++) { //result += string.Format("{0}\t:\t{1}\t", sdr.GetName(i), sdr.GetValue(i)); ht.Add(sdr.GetName(i), sdr.GetValue(i)); } //result += "\n"; list.Add(ht); Console.WriteLine(list.ToString()); } return(list); }
public ArrayList GetSelect(string user) { MySql my = new MySql(); string sql = string.Format("select * from signup where user_number = {0};", user); MySqlDataReader sdr = my.Reader(sql); //string result = ""; ArrayList list = new ArrayList(); while (sdr.Read()) { Hashtable ht = new Hashtable(); for (int i = 0; i < sdr.FieldCount; i++) { //result += string.Format("{0}\t:\t{1}\t", sdr.GetName(i), sdr.GetValue(i)); ht.Add(sdr.GetName(i), sdr.GetValue(i)); } //result += "\n"; list.Add(ht); Console.WriteLine(list.ToString()); } return(list); }
public ArrayList Select(string val) { MySql my = new MySql(); string sql = val; MySqlDataReader sdr = my.Reader(sql); //string result = ""; ArrayList list = new ArrayList(); while (sdr.Read()) { Hashtable ht = new Hashtable(); for (int i = 0; i < sdr.FieldCount; i++) { //result += string.Format("{0}\t:\t{1}\t", sdr.GetName(i), sdr.GetValue(i)); ht.Add(sdr.GetName(i), sdr.GetValue(i)); } //result += "\n"; list.Add(ht); Console.WriteLine(list.ToString()); } ReaderClose(sdr); ConnectionClose(); return(list); }
///// 메소드 구현 public ArrayList GetSelect() { MySql my = new MySql(); string sql = "select book_number, availability, title, author, publisher from book_info;"; MySqlDataReader sdr = my.Reader(sql); //string result = ""; ArrayList list = new ArrayList(); while (sdr.Read()) { Hashtable ht = new Hashtable(); for (int i = 0; i < sdr.FieldCount; i++) { //result += string.Format("{0}\t:\t{1}\t", sdr.GetName(i), sdr.GetValue(i)); ht.Add(sdr.GetName(i), sdr.GetValue(i)); } //result += "\n"; list.Add(ht); Console.WriteLine(list.ToString()); } ReaderClose(sdr); ConnectionClose(); return(list); }
public ArrayList GetSelect() { MySql my = new MySql(); string sql = string.Format("select R.rental_number 대여번호, I.title 도서명, I.author 저자, I.publisher 출판사, R.rental_day 대여일, R.return_schedule 반납일," + " case "+ " when TO_DAYS(now()) - TO_DAYS(return_schedule) > 0 then '연체됨' " + " when TO_DAYS(now()) - TO_DAYS(return_schedule) <= 0 then '연체안됨' " + " else '' " + " end 연체일," + " case "+ " when R.rental_status = 0 then '대여중' " + " when R.rental_status = 1 then '반납요망' " + " else '' " + " end 상태 " + " from book_info as I "+ " inner join book_rental as R on " + " (I.book_number = R.book_number)" + "WHERE R.user_number = {0} && (R.rental_status = 1 || R.rental_status = 0);", Login.User_Number.ToString()); MySqlDataReader sdr = my.Reader(sql); //string result = ""; ArrayList list = new ArrayList(); while (sdr.Read()) { Hashtable ht = new Hashtable(); for (int i = 0; i < sdr.FieldCount; i++) { //result += string.Format("{0}\t:\t{1}\t", sdr.GetName(i), sdr.GetValue(i)); ht.Add(sdr.GetName(i), sdr.GetValue(i)); } //result += "\n"; list.Add(ht); Console.WriteLine(list.ToString()); } return(list); }
private void btn1_Click(object sender, EventArgs e) { if (Tb2.Text == PW_Select(Tb1.Text)) { MessageBox.Show("로그인 성공"); form.lb_Logout.Show(); MySql my = new MySql(); string sql = string.Format("select user_number, member_rank from signup where id = '{0}' && passwod = '{1}';", Tb1.Text, Tb2.Text); MySqlDataReader sdr = my.Reader(sql); while (sdr.Read()) { user_Number = Convert.ToInt32(sdr.GetValue(0).ToString()); member_rank = Convert.ToInt32(sdr.GetValue(1).ToString()); //MessageBox.Show(sdr.GetValue(1).ToString()); } this.Hide(); if (member_rank == 1) { form.user1.Show(); form.btn1.Show(); form.btn2.Show(); form.btn3.Show(); form.btn.Show(); form.Login.Hide(); form.Signup.Hide(); } if (member_rank == 0) { form.user1.Hide(); form.user1.Dispose(); BOOK_INFO_FORM login_user1 = new BOOK_INFO_FORM(form); //user1.FormBorderStyle = FormBorderStyle.None; login_user1.TopLevel = false; login_user1.TopMost = true; login_user1.MdiParent = form; login_user1.Dock = DockStyle.Fill; //판넬크기에 맞게 사이즈 늘림. form.panel1.Controls.Add(login_user1); form.user1 = login_user1; form.user1.Show(); form.btn5.Show(); form.btn6.Show(); form.btn7.Show(); form.btn.Show(); form.Login.Hide(); form.Signup.Hide(); } if (member_rank == 4) { form.lb_Login.Show(); form.lb_Signup.Show(); } else { form.lb_Login.Hide(); form.lb_Signup.Hide(); } } else { MessageBox.Show("아이디 또는 비밀번호가 틀립니다."); } }