private void button1_Click(object sender, EventArgs e) { string userid, password; userid = textBox1.Text; password = maskedTextBox1.Text; var orastr = "User Id=nubitsoft;Password=101171;Data Source=202.143.125.108/fyldb;"; OracleConnection con = new OracleConnection(); //OracleConnection("Data Source=.;Initial Catalog=Login;User ID=sa;Password=gs123"); con.ConnectionString = orastr; con.Open(); // MessageBox.Show(con.ServerVersion); OracleCommand cmd = new OracleCommand("Select USERID,USERNAME,USERPASSWORD from USERS where USERNAME='******' and USERPASSWORD='******'", con); DataTable dt = new DataTable(); OracleDataAdapter adap = new OracleDataAdapter(cmd); adap.Fill(dt); OracleDataReader dr = cmd.ExecuteReader(); dr.Read(); if (dt.Rows.Count > 0) { sUserId = textBox1.Text; sFYear = comboBox1.Text; MyWinApp.MyGlobals.sFYear = sFYear; MyWinApp.MyGlobals.sUserName = sUserId; // this.Hide(); frmIndex frm = new frmIndex(); frm.Icon = this.Icon; frm.ShowDialog(); // MessageBox.Show(dt.Rows.Count.ToString()); } else { textBox1.Text = ""; maskedTextBox1.Text = ""; MessageBox.Show("invalid userid or password"); } con.Close(); }
private void button1_Click(object sender, EventArgs e) { string userid, password; userid = textBox1.Text; password = maskedTextBox1.Text; sFYear = comboBox1.Text; // var orastr = "User Id=rsrir;Password=101171;Data Source=202.143.125.108/fyldb;"; OracleConnection con = new OracleConnection(); //OracleConnection("Data Source=.;Initial Catalog=Login;User ID=sa;Password=gs123"); con.ConnectionString = MyWinApp.MyGlobals.sOrastr; con.Open(); // MessageBox.Show(con.ServerVersion); // OracleCommand cmd = new OracleCommand("Select USERID,USERNAME,USERPASSWORD from USERS where USERNAME='******' and USERPASSWORD='******'", con); OracleCommand cmd = new OracleCommand("pr_LoginPass", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("VsFYear", OracleDbType.Varchar2).Value = sFYear; cmd.Parameters.Add("VsUserName", OracleDbType.Varchar2).Value = userid; cmd.Parameters.Add("VsUserPass", OracleDbType.Varchar2).Value = password; cmd.Parameters.Add("retval", OracleDbType.RefCursor).Direction = ParameterDirection.Output; DataTable dt = new DataTable(); OracleDataAdapter adap = new OracleDataAdapter(cmd); adap.Fill(dt); OracleDataReader dr = cmd.ExecuteReader(); dr.Read(); if (dt.Rows.Count > 0) { sUserId = textBox1.Text; sFYear = comboBox1.Text; MyWinApp.MyGlobals.sFYear = sFYear; MyWinApp.MyGlobals.sUserName = sUserId; // this.Hide(); frmIndex frm = new frmIndex(); frm.Icon = this.Icon; frm.ShowDialog(); // MessageBox.Show(dt.Rows.Count.ToString()); } else { textBox1.Text = ""; maskedTextBox1.Text = ""; MessageBox.Show("invalid userid or password"); } con.Close(); }