Exemplo n.º 1
0
        public double getTotalFineAmount(string dbpath)
        {
            DbCon             con = new DbCon(dbpath);
            DataRowCollection dr  = con.ExecuteSelectCommand("select sum(fineamount) from student_fine");

            return(Convert.ToDouble(dr[0].ItemArray[0]));
        }
Exemplo n.º 2
0
        public bool BookIDExists(string ID)
        {
            bool res = true;

            try
            {
                //cmd=new OleDbCommand("Select * from books ")
                DbCon             con = new DbCon();
                DataRowCollection ds;
                ds = con.ExecuteSelectCommand("select * from Books where BookID='" + ID + "'");
                if (ds.Count > 0)
                {
                    res = true;
                }
                else
                {
                    res = false;
                }
            }
            catch (Exception ex)
            {
                res = false;
                MessageBox.Show(ex.Message);
            }


            return(res);
        }
Exemplo n.º 3
0
        private void BookIDForAutocomplere()
        {
            DataRowCollection            ds = con.ExecuteSelectCommand("select * from Books");
            AutoCompleteStringCollection c  = new AutoCompleteStringCollection();

            for (int i = 0; i < ds.Count; i++)
            {
                c.Add(ds[i].ItemArray[0].ToString());
            }
        }
Exemplo n.º 4
0
        public bool searchStudentByName(string name, string path)
        {
            DbCon             con = new DbCon(path);
            DataRowCollection dr  =
                con.ExecuteSelectCommand("select * from student where studentName like'%" + name + "%'");

            if (dr.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        public bool StudentExists(string ID, string path)
        {
            DbCon             con = new DbCon(path);
            DataRowCollection dr  =
                con.ExecuteSelectCommand("select * from student where studentId='" + ID + "'");

            if (dr.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 6
0
        public bool searchBookbycatagory(string id, string path)
        {
            bool              res;
            DbCon             con = new DbCon(path);
            DataRowCollection dr  =
                con.ExecuteSelectCommand("select * from books where BookcatName Like '%" + id + "%'");

            if (dr.Count > 0)
            {
                res = true;
            }
            else
            {
                res = false;
            }
            return(res);
        }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            string cmdstr = "select * from Books where ";

            if (textBox1.Text == "")
            {
                MessageBox.Show("Provide data in the search field");
                return;
            }
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                cmdstr += " bookID='" + textBox1.Text + "'";
                break;

            case 1:
                cmdstr += " bookname like'%" + textBox1.Text + "%'";
                break;

            case 2:
                cmdstr += " bookpubname like'%" + textBox1.Text + "%'";
                break;

            case 3:
                cmdstr += " bookautname like'%" + textBox1.Text + "%'";
                break;

            case 4:
                cmdstr += " bookcatname like'%" + textBox1.Text + "%'";
                break;

            default:
                break;
            }
            DbCon             db = new DbCon();
            DataRowCollection dr = db.ExecuteSelectCommand(cmdstr);

            for (int i = 0; i < dr.Count; i++)
            {
                dataGridView1.Rows.Add(dr[i].ItemArray);
            }
            //dataGridView1.DataSource = dr;
        }
Exemplo n.º 8
0
        public bool BookIDExists(string ID, string dbpath)
        {
            bool res = true;

            try
            {
                DbCon             con = new DbCon(dbpath);
                DataRowCollection ds;
                ds = con.ExecuteSelectCommand("select * from Books where BookID='" + ID + "'");
                if (ds.Count > 0)
                {
                    res = true;
                }
                else
                {
                    res = false;
                }
            }
            catch (Exception)
            {
                return(false);
            }
            return(res);
        }
Exemplo n.º 9
0
        public DataRowCollection SearchBooks(string search, string dbpath)
        {
            DbCon con = new DbCon(dbpath);

            return(con.ExecuteSelectCommand(search));
        }