/***************************************************************************** * This method is called when 'Create New Record' button is clicked. * It generates a sample XML record for the 'Emp' table and populates the * empRichTextBox with it. The empno is generated automatically. ****************************************************************************/ public string createNewRecord() { try { // Generate unique Empno based on the MAX(empno)+1 OracleCommand empnoCmd = new OracleCommand("SELECT NVL((MAX(empno)+1),8000)" + "FROM emp ", ConnectionMgr.conn); OracleDataReader empnoReader = empnoCmd.ExecuteReader(); empnoReader.Read(); OracleDecimal i = empnoReader.GetDecimal(0); // Create a sample XML document string str = "<?xml version=\"1.0\"?>\n" + "<ROWSET>\n" + " <ROW>\n" + " <EMPNO>" + i.ToString() + "</EMPNO>\n" + " <ENAME>Angela</ENAME>\n" + " <SAL>1000</SAL>\n" + " <DEPTNO>10</DEPTNO>\n" + " </ROW>\n" + "</ROWSET>\n"; empnoCmd.Dispose(); return(str); } catch (Exception ex) { MessageBox.Show("Error " + ex.Message); return(""); } }
private void button_zaloguj_Click(object sender, EventArgs e) { try { SQLCONNECT nowe_polaczenie = new SQLCONNECT(); nowe_polaczenie.Connection(); String text_login_string = text_login.Text; String text_password_string = text_haslo.Text; String sql = "select count(*) from uzytkownicy where user_name = '" + text_login_string + "' AND user_password = '******'"; control_manager_dialog = new OracleCommand(sql, nowe_polaczenie.nowe_polaczenie); control_manager_dialog.CommandType = CommandType.Text; OracleDataReader dr = control_manager_dialog.ExecuteReader(); dr.Read(); OracleDecimal oracledecimal1 = dr.GetOracleDecimal(0); if (oracledecimal1.ToString().Equals("1")) { if (text_login_string == "admin1") { this.Hide(); Menu_admin ss = new Menu_admin(text_login_string); ss.Show(); } else if (text_login_string == "ksiegowa") { this.Hide(); Menu_ksiegowa ss = new Menu_ksiegowa(); ss.Show(); } else if (text_login_string == "anna") { this.Hide(); Menu_opiekun ss = new Menu_opiekun(text_login_string); ss.Show(); } } else { String message_error_login = "******"; MessageBox.Show(message_error_login); } /*data_adapter = new OracleDataAdapter(control_manager_dialog); * command_builder = new OracleCommandBuilder(data_adapter); * wybor_danych = new DataSet(); * * * * data_adapter.Fill(wybor_danych); * * * MessageBox.Show("Zawartosc wczytanej bazy:\n-liczba atrybutow:\t" + wybor_danych.Tables[0].Columns + "\n-liczba rekordow:\t" + wybor_danych.Tables[0].Rows, "Informacja");*/ /*this.Text = "Zawartosc wczytanej bazy, liczba atrybutow: " + wybor_danych.Tables[0].Columns.Count + ", liczba rekordow: " + wybor_danych.Tables[0].Rows.Count;*/ } catch (OracleException ex) { switch (ex.Number) { case 1: MessageBox.Show("Error attempting to insert duplicate data."); break; case 12560: MessageBox.Show("The database is unvaliable."); break; default: MessageBox.Show("Database error: " + ex.Message.ToString()); break; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { //nowe_polaczenie.Dispose(); } }
public override string ToString() { return(_oracleDecimal.ToString()); }
public override string ToString() => _oracleDecimal.IsNull ? String.Empty : _oracleDecimal.ToString();
private void wyswietlProfilZwierzeciaClick(object sender, EventArgs e) { if (nrZwierzecia_textBox.Text.Length == 0) { String message_error_login = "******"; MessageBox.Show(message_error_login); } else { this.Hide(); try { nowe_polaczenie.Connection(); string kot; kot = "select count(nr_zwierzecia) from koty where nr_zwierzecia ='" + nrZwierzecia_textBox.Text + "'"; control_manager_dialog = new OracleCommand(kot, nowe_polaczenie.nowe_polaczenie); control_manager_dialog.CommandType = CommandType.Text; OracleDataReader dr = control_manager_dialog.ExecuteReader(); dr.Read(); OracleDecimal ileKotow = dr.GetOracleDecimal(0); if (ileKotow.ToString().Equals("1")) { profilKot ss = new profilKot(nrZwierzecia_textBox.Text, user_name_login); ss.Show(); } else { profilPies ss = new profilPies(nrZwierzecia_textBox.Text, user_name_login); ss.Show(); } } catch (OracleException ex) { switch (ex.Number) { case 1: MessageBox.Show("Error attempting to insert duplicate data."); break; case 12560: MessageBox.Show("The database is unvaliable."); break; default: MessageBox.Show("Database error: " + ex.Message.ToString()); break; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { //nowe_polaczenie.Dispose(); } } }
public override string ToString() { return(_oracleDecimal.IsNull ? String.Empty : _oracleDecimal.ToString()); }