private void Add() { if (string.IsNullOrWhiteSpace(txtcode.Text)) { MessageBox.Show("Please Enter Code !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtcode.Focus(); } else if (string.IsNullOrWhiteSpace(txtname.Text)) { MessageBox.Show("Please Enter Name !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtname.Focus(); } else { if (btnadd.Text == "&Add") { string Query = "sp_tbitem_ups " + 0 + ",'" + txtcode.Text + "','" + txtname.Text + "','Admin',1"; int i = item.Add(Query); if (i > 0) { MessageBox.Show("Data Successfully Saved !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information); } Clearme(); } else { string Query = "sp_tbitem_ups " + itemId + ",'" + txtcode.Text + "','" + txtname.Text + "','Admin',2"; int i = item.Add(Query); if (i > 0) { MessageBox.Show("Data Successfully Update !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information); } Clearme(); } } }