private void button6_Click(object sender, EventArgs e) { connection sv = new connection(); sv.thisConnection.Open(); OracleCommand thisCommand = sv.thisConnection.CreateCommand(); thisCommand.CommandText = "update data set name = '" + textBox2.Text + "'where id= '" + textBox1.Text + "'"; thisCommand.Connection = sv.thisConnection; thisCommand.CommandType = CommandType.Text; //For Insert Data Into Oracle// try { thisCommand.ExecuteNonQuery(); MessageBox.Show("Updated"); this.Hide(); } catch (Exception ex) { Console.WriteLine(ex.Message); } sv.thisConnection.Close(); this.Close(); DbFeatures ob = new DbFeatures(); ob.Show(); }
private void logincheck() { try { connection CN = new connection(); CN.thisConnection.Open(); OracleCommand thisCommand = new OracleCommand(); thisCommand.Connection = CN.thisConnection; thisCommand.CommandText = "SELECT * FROM usertable WHERE id='" + textBox1.Text + "' AND password='******'"; OracleDataReader thisReader = thisCommand.ExecuteReader(); if (thisReader.Read()) { DbFeatures oform = new DbFeatures(); oform.Show(); this.Hide(); } else { MessageBox.Show("username or password incorrect"); } //this.Close(); CN.thisConnection.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void textBox1_TextChanged(object sender, EventArgs e) { connection CN = new connection(); CN.thisConnection.Open(); OracleCommand thisCommand = CN.thisConnection.CreateCommand(); textBox2.Text = ""; thisCommand.CommandText = "SELECT name FROM data where id= '" + textBox1.Text + "'"; OracleDataReader thisReader = thisCommand.ExecuteReader(); while (thisReader.Read()) { textBox2.Text = thisReader["name"].ToString(); try { // string filePath = thisReader["picture"].ToString(); // this.pb_profilepics.Image = Image.FromFile(filePath); } catch { MessageBox.Show("Failure"); } } }
private void button1_Click(object sender, EventArgs e) { connection con = new connection(); con.thisConnection.Open(); OracleCommand thisCommand1 = con.thisConnection.CreateCommand(); thisCommand1.CommandText = "delete data where id= '" + textBox1.Text + "'"; thisCommand1.Connection = con.thisConnection; thisCommand1.CommandType = CommandType.Text; //For Insert Data Into Oracle// try { thisCommand1.ExecuteNonQuery(); MessageBox.Show("delete successfully"); this.Hide(); DbFeatures ob = new DbFeatures(); ob.Show(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void logincheck() { try { connection CN = new connection(); CN.thisConnection.Open(); OracleCommand thisCommand = new OracleCommand(); thisCommand.Connection = CN.thisConnection; thisCommand.CommandText = "SELECT * FROM usertable WHERE ID='" + textBox1.Text + "' AND password='******'"; OracleDataReader thisReader = thisCommand.ExecuteReader(); if (thisReader.Read()) { frmHome oform = new frmHome(textBox1.Text); oform.Show(); this.Hide(); } else { MetroMessageBox.Show(this, "\n User Name or Password is not Correct!", "Login Error | ADMS", MessageBoxButtons.OK, MessageBoxIcon.Error); } //this.Close(); CN.thisConnection.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void ViewAllStudentData_Load(object sender, EventArgs e) { connection CN = new connection(); CN.thisConnection.Open(); OracleCommand thisCommand = CN.thisConnection.CreateCommand(); thisCommand.CommandText = "SELECT * FROM data order by id"; OracleDataReader thisReader = thisCommand.ExecuteReader(); while (thisReader.Read()) { ListViewItem lsvItem = new ListViewItem(); lsvItem.Text = thisReader["id"].ToString(); lsvItem.SubItems.Add(thisReader["name"].ToString()); lsvItem.SubItems.Add(thisReader["course"].ToString()); lsvItem.SubItems.Add(thisReader["mark"].ToString()); listView1.Items.Add(lsvItem); } CN.thisConnection.Close(); }
private void button7_Click(object sender, EventArgs e) { connection sv = new connection(); sv.thisConnection.Open(); OracleDataAdapter thisAdapter = new OracleDataAdapter("SELECT * FROM data", sv.thisConnection); OracleCommandBuilder thisBuilder = new OracleCommandBuilder(thisAdapter); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, "data"); DataRow thisRow = thisDataSet.Tables["data"].NewRow(); try { thisRow["id"] = textBox1.Text; thisRow["name"] = textBox2.Text; thisRow["course"] = textBox3.Text; thisRow["mark"] = textBox4.Text; thisDataSet.Tables["data"].Rows.Add(thisRow); thisAdapter.Update(thisDataSet, "data"); MessageBox.Show("Submitted"); } catch (Exception ex) { MessageBox.Show(ex.Message); } sv.thisConnection.Close(); DbFeatures ob = new DbFeatures(); ob.Show(); this.Hide(); }
private void DbFeatures_Load(object sender, EventArgs e) { connection CN = new connection(); CN.thisConnection.Open(); OracleCommand thisCommand = CN.thisConnection.CreateCommand(); thisCommand.CommandText = "SELECT * FROM usertable where ID='" + userID + "'"; OracleDataReader thisReader = thisCommand.ExecuteReader(); while (thisReader.Read()) { lbluser.Text = thisReader["username"].ToString(); lbladdress.Text = thisReader["address"].ToString(); lblid.Text = thisReader["ID"].ToString(); } }