Retrieving BLOB files from MSSQL in VBa

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coony
    New Member
    • Jan 2007
    • 1

    Retrieving BLOB files from MSSQL in VBa

    Hi everyone,

    I got an annoying thing going on.
    I've got an MSSQL db which is filled with different data, used by another program (T-Plan). I should read some table to import in another DB. The DB I have to read, contains als BLOB files.
    In Excel I created a connection string, can read all fields & values as shown in the DB, but I can't manage to convert the Blobs to Strings (which is the data in the BLOBs).
    I tried all the next, but unsuccesful: (when reading the data stream and adding values to the excel sheet.
    Cells(rowcount, tel) = StrConv(rst.Fie lds(tel - 1), vbFromUnicode)

    Cells(rowcount, tel) = GetString(rst.F ields(tel - 1))

    Cells(rowcount, tel) = Asc(rst.Fields( tel - 1))

    sAns = StrConv(rst.Fie lds(tel - 1), vbFromUnicode)
    iPos = InStr(sAns, Chr(0))
    If iPos > 0 Then sAns = Left(sAns, iPos - 1)
    Cells(rowcount, tel) = sAns

    Cells(rowcount, tel) = rst.Fields(tel - 1)

    Pls take a look at the screenshot to see some of the 'blob' values in the SQL db.
    Pls notice also that all BLOB files / values, contain 32 characters when show in DB view & when exported to excel.

    [IMG][/IMG]

    An alterantive to convert this data when allready exported to excel, could also help me a lot !

    thanks for any feedback.
    Koen
Working...