vb.net - 如果药物已经过期,我是否更改了 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
解决方案
我不明白您要做什么或将如何加载网格。更改列颜色的任何方法都是:
dgv1.Columns("columnsName").DefaultCellStyle.BackColor = Color.Red
推荐阅读
- javascript - 使用 Javascript 从 PHP 获取 JSON 数据:
- python - 给定一个 Redis Broker 和一个 db-backend,Celery Task 请求首先写入哪里?
- generics - 如何在实现中继承泛型类型而在 Kotlin 中没有泛型接口?
- postgresql - 可以在 AWS RDS 上启用“使用 LLVM 进行 JIT 编译”Postgres 11 func 吗?
- mongodb - 在 MongoDB 中分组结果
- android - 如何正确构建具有继承的房间实体
- html - 角度材质导航无法正常工作
- python - 创建后如何设置django HttpResponse内容?
- java - 如何在循环外使用多个字符串的数组
- c++ - 库函数所需的标准输入未阻止调试控制台