mysql - 如何检查mysql行中是否有值?

标签 mysql vb.net image

抱歉我的英语不好

我想问一下如何检查行中是否有值?

提前致谢:)

Private Sub uploadpic()

    Dim SQLCmd As New MySqlCommand("SELECT Picture FROM Student_information WHERE S_I_D = ('" & ListView1.Items(ListView1.FocusedItem.Index).SubItems(0).Text & "') ", dbcon)

    dbcon.Open()

    *Dim pictureData As Byte() = DirectCast(SQLCmd.ExecuteScalar(), Byte())*

    dbcon.Close()

    Dim picture As Image = Nothing

    'Create a stream in memory containing the bytes that comprise the image.

    Using stream As New IO.MemoryStream(pictureData)
        'Read the stream and create an Image object from the data.
        PictureBox4.Image = Image.FromStream(stream)
    End Using


End Sub

最佳答案

SQLCmd.ExecuteScalar()如果结果集为空,将返回空引用。因此,您可以检查该值以了解行中是否有值。

关于mysql - 如何检查mysql行中是否有值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15213351/

相关文章:

mysql - mysql可以一张表建几张表吗?

php - 生成/下载大型 Excel 文件 - PhpExcel

vb.net - DataGridView 中的额外行

image - Word 2010 结合了 INCLUDEPICTURE 和 IF

html - 在屏幕上拉伸(stretch) 1 个 div 中包含的图像

javascript - 使用 Javascript 通过变量切换图像

mysql - 无法在 JBoss 7.1.1 中设置 MySQL 数据源

php - mysql查询返回错误值

vb.net - 如何在桌面应用程序中添加 Facebook Like 按钮?

asp.net - 以编程方式将用户控件加载到占位符 (asp.net)