Beispiel #1
0
        public void btnsave_Click(object sender, EventArgs e)
        {
            if (txtsankayname.Text == "")
            {
                MessageBox.Show("Null Value Not Allowed ");
            }
            else
            {
                if (add_edit == true)
                {
                    DataSet ds = Connection.GetDataSet("select count(* ) from tbl_district where district='" + txtsankayname.Text + "'");
                    int     i  = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                    if (i == 0)
                    {
                        Connection.AllPerform("insert into tbl_district values('" + txtsankayname.Text + "','" + valcmbdistrict.Text + "')");
                    }
                    else
                    {
                        MessageBox.Show("Duplicate data not allowed");
                    }
                    showList();
                }
                if (add_edit == false)
                {
                    Connection.AllPerform("UPDATE TBL_DISTRICT SET  district='" + txtsankayname.Text + "', statename='" + valcmbdistrict.Text + "'  where distcode='" + txtsankaycode.Text + "'");
                    //c.updatedata("tbl_district", c.myconn, this, "district", txtsankaycode.Text);
                }

                c.FillListBox("SELECT     distinct distcode, district  FROM         tbl_district  order by district", "district", "statename", ref listBox1);
                MessageBox.Show("Record Saved...", "School");
                c.btnenable(btnnew, btnedit, btndelete, btnsave, btncancel, btnprint, btnedit);
            }
        }
Beispiel #2
0
 private void Frmsubject_Load(object sender, EventArgs e)
 {
     c.btnenable(btnnew, btnedit, btndelete, btnsave, btncancel, btnprint, btnexit);
     c.getconnstr();
     c.FillListBox("Select subjectno,subjectname,SubjectCode ,SubjectOrder from tbl_subject Group By subjectno,subjectname,SubjectCode ,SubjectOrder Order By SubjectOrder ", "subjectname", "subjectno", ref listBox1);
     cmbSubjectOrder.Items.Clear();
     for (int i = 1; i <= listBox1.Items.Count; i++)
     {
         cmbSubjectOrder.Items.Add(i);
     }
     btnnew.Focus();
 }
Beispiel #3
0
        private void frmsankay_Load(object sender, EventArgs e)
        {
            c.btnenable(btnnew, btnedit, btndelete, btnsave, btncancel, btnprint, null);
            c.getconnstr();

            c.FillcomboBox("select * from tbl_district order by district", "district", "distcode", ref valcmbdistrict);
            c.FillListBox("select * from tbl_tehsil order by tehsil", "tehsil", "tehcode", ref listBox1);

            c.returnconn(c.myconn);
            SqlCommand command = new SqlCommand("select max(tehcode) from tbl_tehsil", c.myconn);

            command.CommandTimeout = 120;
            Int32 mstudentno;

            mstudentno = 1001;
            if (command.ExecuteScalar() != System.DBNull.Value)
            {
                mstudentno = Convert.ToInt32(command.ExecuteScalar()) + 1;
            }
        }
Beispiel #4
0
        private void FrmPublisher_Load(object sender, EventArgs e)
        {
            c.btnenable(btnnew, btnedit, btndelete, btnsave, btncancel, btnprint, btnexit);
            c.getconnstr();
            btnnew.Focus();

            c.FillListBox("select * from tbl_publisher", "publishar", "publishcode", ref listBox1);

            c.returnconn(c.myconn);
            SqlCommand command = new SqlCommand("select max(publishcode) from tbl_publisher", c.myconn);

            command.CommandTimeout = 120;
            Int32 mstudentno;

            mstudentno = 1001;
            if (command.ExecuteScalar() != System.DBNull.Value)
            {
                mstudentno = Convert.ToInt32(command.ExecuteScalar()) + 1;
            }
        }