For Each dgvr As DataGridViewRow In DataGridView1.SelectedRows Using sqlcon As New SqlConnection(connectionstring + ComboBox1.Text + ".mdf;Integrated Security=True") Try sqlcon.Open() Dim Sources As String = "Delete from " + "[Profile]" + " where Id = @ID" Dim cmd As SqlClient.SqlCommand cmd = New SqlClient.SqlCommand(Sources, sqlcon) cmd.Parameters.AddWithValue("@ID", dgvr.Cells(0).Value.ToString) cmd.ExecuteNonQuery() sqlcon.Close() Catch ex As Exception End Try End Using Next
ON DELETE CASCADE
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)