vb.net和sql标记 [英] vb.net and sql flagging

查看:66
本文介绍了vb.net和sql标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助im新手编程即时使用vb.net和sql



i想要突出显示青色的值(1)删除我不想删除数据而不是我用来强调它作为vb.net中的删除方式,当我停止并重新运行程序突出显示的数据没有突出显示



这是我的代码:



please help im newbie in programming im using vb.net and sql

i want to highlight with color cyan the value (1) for deletion i dont want to delete data instead i use to highlight it as way of deletion in vb.net when i stop and re run again the program the highlighted data was unhighlighted

this is my code:

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()
            objRow.DefaultCellStyle.BackColor = Color.Cyan

        Next
    End Using
 End sub
        con.Close()





任何人都可以帮我解决这类程序,感谢您的考虑提前感谢



can anyone help me in this kind of program thanks for consideration thanks in advance

推荐答案

DataGridView行的颜色不会自动延续到数据库中。您必须更新数据库表中将行标记为已删除的列。随后检索数据时,必须检查已删除列的值,然后在该数据行的DataGridView行中设置颜色,以指示它是已删除的行。
The color of a DataGridView row is not automatically perpetuated into the database. You have to update a column in the database table that marks a row as "deleted". When you subsequently retrieve the data, you must check the value of the "deleted" column and then set the color in the DataGridView row for that data row to indicate that it is a deleted row.


多数民众赞成我所做的但是它不起作用
thats what i did but it doesnt work


这篇关于vb.net和sql标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆