如何识别Access Blob字段数据以及如何读取它 [英] How to identity Access Blob field data and how to read it

查看:610
本文介绍了如何识别Access Blob字段数据以及如何读取它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有访问Blob字段.不知道Blob字段中存在什么类型的数据.如何识别blob字段中的数据,以及如何使用vb.net

Iam Having Access Blob field. Do not know what type of data is there in blob field. How to recognize the data in blob field and how to read the data using vb.net

推荐答案

Blob字段始终包含二进制数据,您只需将其读入字节数组:
A Blob field always contains binary data, you just read it out into an array of bytes:
Dim da As New SqlDataAdapter(Select * From MyImages", con)
Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet()
con.Open()
da.Fill(ds, "MyImages")
Dim myRow As DataRow
myRow = ds.Tables("MyImages").Rows(0)
Dim MyData() As Byte
MyData = myRow("imgField")

这来自如何读取和写入BLOB数据 [

This came from How To Read and Write BLOB Data[^] which was very easily found, using Google.

After that, it''s up to you to use it appropriately: what information did you save in the field in the first place?


Blob字段表示二进制大对象 b>字段通常包含二进制数据.可以像给定函数中那样通过Filestream和Binary Reader进行读取
Blob Field Means Binary Large object Field they generally Contains Binary data .they Can be Read Through Filestream and Binary Reader as in the Given Function
Private Function ReadFile(ByVal sPath As String) As Byte()
        ''Initialize byte array with a null value initially. 
        Dim data As Byte() = Nothing

        ''Use FileInfo object to get file size. 
        Dim fInfo As New FileInfo(sPath)
        Dim numBytes As Long = fInfo.Length

        ''Open FileStream to read file 
        Dim fStream As New FileStream(sPath, FileMode.Open, FileAccess.Read)

        ''Use BinaryReader to read file stream into byte array. 
        Dim br As New BinaryReader(fStream)

        ''When you use BinaryReader, you need to supply number of bytes to read from file. 
        ''In this case we want to read entire file. So supplying total number of bytes. 
        data = br.ReadBytes(CInt(numBytes))

        Return data
    End Function



有关BLOB字段的更多信息
搜索Google



For More Information on BLOB fields
Search Google


这篇关于如何识别Access Blob字段数据以及如何读取它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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