how i use transaction in this code : i was trying to use this code without transaction but it gave me error so i want to use it with transaction, so how i can use ?
my code is 

    SqlConnection con= new SqlConnection("Data Source=.;Initial Catalog=Sample;Integrated Security=true;");
        SqlCommand cmd;
        SqlDataAdapter adapt;
    
    private void btn_Update_Click(object sender, EventArgs e)
    {
        string query="insert into users(Name,Password)values('ubaid','ali')";
        cmd = new SqlCommand(query, con);
        con.Open();
        cmd.ExecuteNonQuery();
        MessageBox.Show("Record Updated Successfully");
        con.Close();
    }