} //End Of delete Function

        public static void InsertData(CompanyInformationClass stock)
        {
            string query = "INSERT INTO CompanyInfoTable (CompanyName, CompanyAdd, CompanyNumber1,CompanyNumber2 ) VALUES('" + stock.Name.ToUpper() + "','" + stock.Address.ToUpper() + "','" + stock.PhoneNo + "','" + stock.Cell + "' );";

            try
            {
                DataTable _dtable = null;

                _dtable = dbAccess.ReadDataFromDb(query);
            }
            catch (Exception ex)
            { throw ex; }
        }   //End Of Insert Function
        }   //End Of delete Function

        public static void DeleteData(CompanyInformationClass sale)
        {
            string query = "Delete From CompanyInfoTable Where CompanyName='" + sale.Name.ToUpper() + "' and CompanyAdd='" + sale.Address.ToUpper() + "'";

            try
            {
                DataTable _dTable = null;

                _dTable = dbAccess.ReadDataFromDb(query);
            }
            catch (Exception ex)
            { throw ex; }
        }   //End Of delete Function
Exemplo n.º 3
0
        private void Delete_Click(object sender, EventArgs e)
        {
            CompanyInformationClass s = new CompanyInformationClass();

            try
            {
                s.Name    = textname.Text.Trim();
                s.Address = txtAddress.Text;
                QueryClass.DeleteData(s);
                MessageBox.Show("Delete Successfully");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error", ex.Message);
            }
        }
Exemplo n.º 4
0
        private void Save_Click(object sender, EventArgs e)
        {
            CompanyInformationClass ss = new CompanyInformationClass();

            try
            {
                ss.Name    = textname.Text.Trim();
                ss.Address = txtAddress.Text.Trim();
                ss.Cell    = Convert.ToInt32(txtPhone.Text.Trim());
                ss.PhoneNo = Convert.ToInt32(txtCell.Text.Trim());
                QueryClass.InsertData(ss);
                MessageBox.Show("Add Successfully");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error", ex.Message);
            }
        }