Jump to content
ÐÒ&

C# stergere din baza de date...dupa un camp

Recommended Posts

Posted

Ne folosim de data Grid View.(cel la care de altfel ii dam si fill,adica tabelul care ne va afisa record set

   private void buttonDelete_Click(object sender, EventArgs e)
{
string sters = dataGridView1.CurrentCell.Value.ToString();
SqlCommand sel = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
DataTable dt = new DataTable();
SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Barbu;Integrated Security=SSPI;");
sel.CommandText = "DELETE FROM [dbo-baieti] WHERE nume='"+sters+"'";


sel.Connection = conn;

conn.Open();

sel.ExecuteNonQuery();


}

se sterge dupa recordul din coloana selectata.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...