public OleDbDataReader sectionWork()
        {
            string          query = null;
            connection      cn    = new connection();
            OleDbConnection con   = cn.Connect();

            con.Open();

            if (section == "1st Year")
            {
                query = "SELECT COUNT(section_std) FROM studentDetails where year_std = '1st Year'";
            }
            else if (section == "2nd Year")
            {
                query = "SELECT COUNT(section_std) FROM studentDetails where year_std = '2nd Year'";
            }
            else
            {
                query = "SELECT COUNT(section_std) FROM studentDetails";
            }
            OleDbCommand    cmd    = new OleDbCommand(query, con);
            OleDbDataReader reader = cmd.ExecuteReader();

            return(reader);
        }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox3.Text == textBox4.Text)
         {
             string          id       = textBox1.Text;
             string          depart   = textBox2.Text;
             string          password = textBox3.Text;
             connection      cn       = new connection();
             OleDbConnection con      = cn.Connect();
             con.Open();
             string       query = "Insert into financeDepartUsers(ID,department_user,password_user) values('" + id + "','" + depart + "','" + password + "')";
             OleDbCommand cmd   = new OleDbCommand(query, con);
             cmd.ExecuteNonQuery();
             con.Close();
             MessageBox.Show("Data sucessfully Inserted!!");
         }
         else
         {
             MessageBox.Show("Password not matched!!");
         }
     }
     catch (OleDbException)
     {
         MessageBox.Show("Already created user!!");
     }
 }
        public void insertStudent()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string       query = "INSERT INTO studentDetails(registrationNo,admissionDate,firstName, lastName, dateOfBirth, gender_std,fatherName,relationship_std,fatherOccupation,annualIncome,nationality_std,bloodGroup,religion_std,field_std,year_std,section_std,phoneNumber,address_std,parcentage_matric) VALUES (@rgNo,@AdmDate,@fName, @lName, @db, @gn,@fN,@rl,@fO,@In,@nt,@bld,@r,@fielD,@year,@sect,@phNo,@adrs,@mat)";
            OleDbCommand cmd   = new OleDbCommand(query, con);

            cmd.Parameters.AddWithValue("@rgNo", Rno);
            cmd.Parameters.AddWithValue("@AdmDate", admissionDate);

            cmd.Parameters.AddWithValue("@fName", firstName);
            cmd.Parameters.AddWithValue("@lName", lastName);
            cmd.Parameters.AddWithValue("@db", dateBirth);
            cmd.Parameters.AddWithValue("@gn", gender);
            cmd.Parameters.AddWithValue("@fN", fatherName);
            cmd.Parameters.AddWithValue("@rl", status);
            cmd.Parameters.AddWithValue("@fO", fatheOccupation);
            cmd.Parameters.AddWithValue("@In", income);
            cmd.Parameters.AddWithValue("@nt", nationality);
            cmd.Parameters.AddWithValue("@bld", blood);
            cmd.Parameters.AddWithValue("@r", religion);

            cmd.Parameters.AddWithValue("@fielD", field);
            cmd.Parameters.AddWithValue("@year", year);
            cmd.Parameters.AddWithValue("@sect", section);
            cmd.Parameters.AddWithValue("@phNo", phoneNumber);
            cmd.Parameters.AddWithValue("@adrs", address);
            cmd.Parameters.AddWithValue("@mat", parcentage);

            cmd.ExecuteNonQuery();
            con.Close();
        }
        public OleDbDataReader reader(string query)
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            OleDbCommand    cmd    = new OleDbCommand(query, con);
            OleDbDataReader reader = cmd.ExecuteReader();

            return(reader);
        }
        public void updateBook(string query)
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();

            OleDbCommand cmd = new OleDbCommand(query, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
        public void deleteBook()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string       query = "delete * from addingBooks where serialNo = " + serial;
            OleDbCommand cmd   = new OleDbCommand(query, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
        public void insertBook()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string       query = "Insert into addingBooks(titleBook,authorBook,quantity,placeLibrary,conditionBook)values('" + title + "','" + authorName + "','" + quantityBook + "','" + place + "','" + condition + "')";
            OleDbCommand cmd   = new OleDbCommand(query, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
        public void insertRollSection()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string       query = "INSERT INTO rollNumbers(title,year_std) values('" + section + "','" + year + "')";
            OleDbCommand cmd   = new OleDbCommand(query, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
        public void updateQuantity()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();

            OleDbCommand cmd = new OleDbCommand(updateQuery, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
        public void deleteRow()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string       query = "delete * from IssueBooks where studentID=" + studentNo + "and bookID=" + bookNo;
            OleDbCommand cmd   = new OleDbCommand(query, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
Exemple #11
0
        public void update(string cmdText)
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();

            OleDbCommand cmd = new OleDbCommand(cmdText, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
Exemple #12
0
        public OleDbDataReader selectingOldPassword()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string          cmdText = "select password_user from admissionDepartUsers";
            OleDbCommand    cmd     = new OleDbCommand(cmdText, con);
            OleDbDataReader reader  = cmd.ExecuteReader();

            return(reader);
        }
Exemple #13
0
        public void insertPayment()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string       query = "insert into employeePayments(employeeID,salaryMonth,salary,datePayment) values('" + ID + "','" + months + "','" + empSalary + "','" + today + "')";
            OleDbCommand cmd   = new OleDbCommand(query, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
Exemple #14
0
        public DataTable tableData(string query)
        {
            connection       cn     = new connection();
            OleDbConnection  con    = cn.Connect();
            OleDbCommand     objCmd = new OleDbCommand(query, con);
            OleDbDataAdapter objDA  = new OleDbDataAdapter(objCmd);

            objDA.SelectCommand.CommandText = objCmd.CommandText.ToString();
            DataTable dt = new DataTable();

            objDA.Fill(dt);
            return(dt);
        }
Exemple #15
0
        public DataSet goFill(string mySelect)
        {
            connection cn = new connection();

            OleDbConnection conn = cn.Connect();

            conn.Open();
            DataSet          ds      = new DataSet();
            OleDbDataAdapter adapter = new OleDbDataAdapter(mySelect, conn);

            adapter.Fill(ds);
            return(ds);
        }
Exemple #16
0
        public DataSet goFill()
        {
            connection cn = new connection();

            OleDbConnection conn = cn.Connect();

            conn.Open();
            DataSet          ds      = new DataSet();
            OleDbDataAdapter adapter = new OleDbDataAdapter(query, conn);

            adapter.Fill(ds);
            return(ds);
        }
Exemple #17
0
        public DataSet studentSheet()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();
            DataSet         ds  = new DataSet();
            string          ayub1;

            ayub1 = "select * from employeeDataBox";
            OleDbDataAdapter adapter = new OleDbDataAdapter(ayub1, con);

            adapter.Fill(ds);
            return(ds);
        }
Exemple #18
0
        public OleDbDataReader selecting()
        {
            loginClass cl = new loginClass();

            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string          cmdText = "select Id from admissionDepartUsers";
            OleDbCommand    cmd     = new OleDbCommand(cmdText, con);
            OleDbDataReader reader  = cmd.ExecuteReader();

            return(reader);
        }
        public void minusQuantity(int id)
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string mySelect;

            mySelect = string.Format("update addingBooks set quantity= quantity - {0} where quantity > {1} and serialNo=" + id, minus, 0);
            OleDbCommand cmd = new OleDbCommand(mySelect, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
        public void insertData()
        {
            firstYearCalculation();
            secondYearCalculation();
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string       query = "insert into seatsSections(seatsFirstYear,sectionsFirstYear,remainingsFirstYear,maxAllowFyear,seatsSecondYear,sectionsSecondYear,remainingsSecondYear,maxAllowSyear)values('" + totalSeatsFirstYear + "','" + sectionsFyear + "','" + remainingFyear + "','" + firstMaxAllow + "','" + totalSeatsSecondYear + "','" + sectionsLyear + "','" + remainingLyear + "','" + secondMaxAllow + "')";
            OleDbCommand cmd   = new OleDbCommand(query, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
        public void insertStudentFee()
        {
            datePaid = DateTime.Now;

            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();

            string       query = "insert into studentFees(studentID,studentName,studentYear,paymentDate,paymentAmount,dueAmount,balanceAmount,monthName) values('" + studentNo + "','" + name + "','" + year + "','" + datePaid + "','" + amountPaid + "','" + dueAmount() + "','" + balanceAmount() + "','" + month + "')";
            OleDbCommand cmd   = new OleDbCommand(query, con);

            cmd.ExecuteNonQuery();
            con.Close();
        }
        public DataSet goFill()
        {
            connection      cn   = new connection();
            OleDbConnection conn = cn.Connect();

            conn.Open();
            DataSet ds = new DataSet();
            string  mySelect;

            mySelect = "SELECT * from addingBooks";
            OleDbDataAdapter adapter = new OleDbDataAdapter(mySelect, conn);

            adapter.Fill(ds);
            return(ds);
        }
Exemple #23
0
        public int countAdmission(string query)
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();

            OleDbCommand    cmd    = new OleDbCommand(query, con);
            OleDbDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                count = reader.GetInt32(0);
            }
            return(count);
        }
Exemple #24
0
        public string countingDepartUsers(string query)
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            OleDbCommand cmd = new OleDbCommand(query, con);

            OleDbDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                mess = reader[0].ToString();
            }
            return(mess);
        }
Exemple #25
0
        public string getGrade()
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string          query  = "select salaryPerMonth from employeeBoxData where Id=" + ID;
            OleDbCommand    cmd    = new OleDbCommand(query, con);
            OleDbDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                grade = reader[0].ToString();
            }
            return(grade);
        }
        public string alreadyExitsBook(string query)
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();

            OleDbCommand    cmd    = new OleDbCommand(query, con);
            OleDbDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                checking = reader[0].ToString();
            }
            return(checking);
        }
Exemple #27
0
        public int getSalary()
        {
            getGrade();
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();
            string          query  = "select salary from payScales where gradeNo=" + Convert.ToInt32(getGrade());
            OleDbCommand    cmd    = new OleDbCommand(query, con);
            OleDbDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                salary = Convert.ToInt32(reader[0]);
            }
            return(salary);
        }
        public int returningTotalSeats(string query)
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();


            OleDbCommand    cmd    = new OleDbCommand(query, con);
            OleDbDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                maxAllow = Convert.ToInt32(reader[0]);
            }
            return(maxAllow);
        }
Exemple #29
0
        public int readFees(string myQuery)
        {
            connection      cn  = new connection();
            OleDbConnection con = cn.Connect();

            con.Open();

            OleDbCommand    cmd    = new OleDbCommand(myQuery, con);
            OleDbDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                getAmounts = Convert.ToInt32(reader[0]);
            }

            return(getAmounts);
        }
        public DataSet fillData(int id)
        {
            connection cn = new connection();

            OleDbConnection conn = cn.Connect();

            conn.Open();
            DataSet ds = new DataSet();
            string  mySelect;


            mySelect = "SELECT serialNo,titleBook,authorBook,quantity,placeLibrary,conditionBook from addingBooks where serialNo =" + id;
            OleDbDataAdapter adapter = new OleDbDataAdapter(mySelect, conn);

            adapter.Fill(ds);
            return(ds);
        }