private void OK_Click( object sender, EventArgs e ) { try { OracleConnection conn = ConnectionOracle.creaConnection(); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.CommandText = "select count(*) from admins where id='"+tno.Text+"' and psw='"+Psw.Text+"'"; OracleDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { if (reader[0].ToString ().Equals ( "1" )) { this.Hide(); View_illstudent stu = new View_illstudent(); stu.Show(); return; } } MessageBox.Show("用户没有找到"); // cmd.ExecuteScalar() + ""; // int raw = cmd.ExecuteOracleScalar(); } catch (Exception e1) { MessageBox.Show(e1.Message); throw; } }
private void treeView1_AfterSelect( object sender, TreeViewEventArgs e ) { // MessageBox.Show(treeView1.SelectedNode.ToString()); if (treeView1.SelectedNode.ToString().EndsWith("查看违章学生记录")) { this.Hide(); View_illstudent stu = new View_illstudent(); stu.Show(); } else if (treeView1.SelectedNode.ToString().EndsWith("更新数据")) { this.Hide(); Update update = new Update(); update.Show(); } else if (treeView1.SelectedNode.ToString().EndsWith("学生借书")) { this.Hide(); Borrow borrow = new Borrow(); borrow.Show(); } else if (treeView1.SelectedNode.ToString ().EndsWith ( "查看个人信息" )) { this.Hide (); myinformation myinfo = new myinformation(); myinfo.Show(); } else if (treeView1.SelectedNode.ToString ().EndsWith ( "查看当前借阅" )) { this.Hide (); myborrow mybo = new myborrow(); mybo.Show(); } else if (treeView1.SelectedNode.ToString ().EndsWith ( "申请续借" )) { this.Hide (); myborrow ba = new myborrow(); ba.Show(); } else if (treeView1.SelectedNode.ToString ().EndsWith ( "图书查询" )) { this.Hide (); Query query = new Query(); query.Show(); } // MessageBox.Show("nicuole"); }