datagridview不会显示来自mysql的pdf文件,它在存放pdf的表上有红色的x标记。我希望文件名显示在datagridview上。我真的需要帮助。多谢了。我正在使用vb.net和workbench。
Private Sub Admin_Handouts_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=; userid=; password=; database=cai"
MysqlConn.Open()
sql = "SELECT Code FROM cai.subjects"
command = New MySqlCommand(sql, MysqlConn)
da = New MySqlDataAdapter
dt = New DataTable
da.SelectCommand = command
da.Fill(dt)
dgvfiles.DataSource = dt
Catch ex As MySqlException
MsgBox(ex.Message)
Finally
MysqlConn.Close()
da.Dispose()
End Try
End Sub
1条答案
按热度按时间flvtvl501#
如果您有itextsharp库,则可以在将pdf作为对象加载时从中读取文档属性。
不过,我不知道当您将文件添加到表中时,该文件是否会保留filename属性。
https://github.com/itext/itext7-dotnet