首页 > 解决方案 > 如果药物已经过期,我是否更改了 datagridview 中行的背景颜色?

问题描述

如果药物已经过期,我是否更改了 datagridview 中行的背景颜色?

        con.Open()
        Dim query As String
        query = "Select product_code,drug_name,quantity,expiration_date from medicine where expiration_date"
        command = New MySqlCommand(query, con)
        readers = command.ExecuteReader

        Dim count As Integer
        count = 0
        While readers.Read
            count = count + 1
        End While
        con.Close()
        If count = 0 Then
            MsgBox("no expiration")
        Else
            Dim SQL As String = ""
            Dim da As MySqlDataAdapter = Nothing
            Dim dt As New DataTable
            SQL = "Select product_code,drug_name,quantity,expiration_date from medicine where expiration_date"
            command = New MySqlCommand(SQL, con)
        End If

标签: vb.net

解决方案


我不明白您要做什么或将如何加载网格。更改列颜色的任何方法都是:

           dgv1.Columns("columnsName").DefaultCellStyle.BackColor = Color.Red

推荐阅读