请帮助使用 vb.net 和 sql server 进行标记,当双击 datagridview 中的选定数据时,我希望删除的值 (1) 将以青色突出显示
这是我的代码
Private Sub showme()
Dim i As Integer
For i = 0 To dgvDoctorsList.RowCount > -1
Dim remrks = dgvDoctorsList.Rows(i).Cells(6).Value
If remrks = "1" Then
dgvDoctorsList.Rows(i).DefaultCellStyle.BackColor = Color.Cyan
End If
Next
End Sub
Private Sub dgvDoctorsList_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvDoctorsList.CellDoubleClick
If MessageBox.Show("Are you sure want to delete this data ?", "CONFIRMATION", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then
Dim objCmd As New SqlCommand()
Using con As New SqlConnection("server=ACHACOSOFAMILY;database=jjasgh;integrated security=true")
objCmd.Connection = con
con.Open()
For Each objRow As DataGridViewRow In dgvDoctorsList.SelectedRows
objCmd.CommandText = "Update tbl_Doctor SET Remarks=1 where License_no=@license"
objCmd.Parameters.AddWithValue("@license", dgvDoctorsList.CurrentRow.Cells(0).Value)
objCmd.ExecuteNonQuery()
showme()
Next
End Using
End sub
感谢您的考虑请帮助提前谢谢