Ejemplo n.º 1
0
 //get EmployeeID
 private string EmployeeID(string employeeText)
 {
     try
     {
         database      db        = new database();
         string        query     = "SELECT empid FROM tblemp where name='" + employeeText + "'";
         SQLiteCommand myCommand = new SQLiteCommand(query, db.myConnection);
         db.OpenConnection();
         string result = Convert.ToString(myCommand.ExecuteScalar());
         db.CloseConnection();
         //MessageBox.Show("Rows Added: {0}", result.ToString());
         return(result);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(null);
     }
 }
Ejemplo n.º 2
0
        //get designname
        private string designationName(int designationID)
        {
            try
            {
                database db    = new database();
                string   query = "SELECT designation FROM tbldesignation where desigid='" + designationID + "'";

                SQLiteCommand myCommand = new SQLiteCommand(query, db.myConnection);
                db.OpenConnection();
                string result = Convert.ToString(myCommand.ExecuteScalar());
                db.CloseConnection();
                //MessageBox.Show("Rows Added: {0}", result.ToString());
                return(result);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }
Ejemplo n.º 3
0
        private void deleteBook(int bookID)
        {
            try
            {
                database db = new database();

                string query = "delete from tblbook where bookid='" + bookID + "'";

                SQLiteCommand myCommand = new SQLiteCommand(query, db.myConnection);
                db.OpenConnection();
                // string result = Convert.ToString(myCommand.ExecuteScalar());
                myCommand.ExecuteScalar();
                db.CloseConnection();
                //MessageBox.Show("Rows Added: {0}", result.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
 private void ReportPublisherWise_Load(object sender, EventArgs e)
 {
     try
     {
         database db    = new database();
         string   query = "SELECT name FROM tblpublisher;";
         db.OpenConnection();
         SQLiteCommand    myCommand = new SQLiteCommand(query, db.myConnection);
         SQLiteDataReader rdr       = myCommand.ExecuteReader();
         while (rdr.Read())
         {
             comboBox1.Items.Add(rdr.GetValue(0).ToString());
         }
         db.CloseConnection();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     comboBox1.SelectedIndex = 0;
 }
Ejemplo n.º 5
0
        private int rowsCount()
        {
            try
            {
                database db = new database();

                string query = "SELECT Count(*) FROM tblissued";

                SQLiteCommand myCommand = new SQLiteCommand(query, db.myConnection);
                db.OpenConnection();
                int result = Convert.ToInt32(myCommand.ExecuteScalar());
                db.CloseConnection();
                //MessageBox.Show("Rows Added: {0}", result.ToString());
                return(result);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(0);
            }
        }
        //get CAN
        private string lastCAN()
        {
            try
            {
                database db = new database();

                string query = "select city from tblbook order by bookid desc limit 1";

                SQLiteCommand myCommand = new SQLiteCommand(query, db.myConnection);
                db.OpenConnection();
                string result = Convert.ToString(myCommand.ExecuteScalar());
                db.CloseConnection();
                //MessageBox.Show("Rows Added: {0}", result.ToString());
                return(result);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }
Ejemplo n.º 7
0
 private void ReportAuthorWise_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'databaseDataSet.tblauthor' table. You can move, or remove it, as needed.
     this.tblauthorTableAdapter.Fill(this.databaseDataSet.tblauthor);
     try
     {
         database db    = new database();
         string   query = "SELECT name FROM tblauthor";
         db.OpenConnection();
         SQLiteCommand    myCommand = new SQLiteCommand(query, db.myConnection);
         SQLiteDataReader rdr       = myCommand.ExecuteReader();
         while (rdr.Read())
         {
             comboBox1.Items.Add(rdr.GetValue(0).ToString());
         }
         db.CloseConnection();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     comboBox1.SelectedIndex = 0;
 }