|
LibPhone.Text = LibGridView1.SelectedRows[0].Cells[3].Value.ToString()
|
bet | 10/12 | Sana | 14.05.2024 | Hajmi | 2,44 Mb. | | #232837 |
Bog'liq Abdulloyeva SitoraLibPhone.Text = LibGridView1.SelectedRows[0].Cells[3].Value.ToString();
}
public void populate()
{
con.Open();
string query = "select* from Librarian";
SqlDataAdapter da = new SqlDataAdapter(query, con);
SqlCommandBuilder builder = new SqlCommandBuilder(da);
var ds = new DataSet();
da.Fill(ds);
LibGridView1.DataSource = ds.Tables[0];
con.Close();
}
private void button1_Click(object sender, EventArgs e)
{
if (LibID.Text == "" LibName.Text == "" LibPass.Text == "" LibPhone.Text == "" )
{
MessageBox.Show("Ma'lumot to'liq emas");
}
else
{
con.Open();
SqlCommand cmd = new SqlCommand("insert into Librarian values(" + LibID.Text + ",'" + LibName.Text + "','" + LibPass.Text + "','" + LibPhone.Text + "')", con);
cmd.ExecuteNonQuery();
MessageBox.Show("Muvaffaqiyatli qo'shildi");
con.Close();
populate();
}
}
private void label5_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
if (LibID.Text == "" )
{
MessageBox.Show("Ma'lumot to'liq emas");
}
else
{
con.Open();
string query = "Delete from Librarian where LibID=" + LibID.Text + ";";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
MessageBox.Show("Muvaffaqiyatli o'chirildi");
con.Close();
populate();
}
}
private void button2_Click(object sender, EventArgs e)
{
|
| |