Article View: borland.public.cppbuilder.database.ado
Article #660BLOB Field
From: kev
Date: Tue, 07 Feb 2006 18:03
Date: Tue, 07 Feb 2006 18:03
36 lines
2178 bytes
2178 bytes
I am having a difficult time writing "BLOB" data into a SQL Server database.
I can read the data out with no problem using the following code:
MemSize = Field1->DataSize; // add one for null terminator
ByteBuffer = new byte[MemSize]; // Allocate the memory.
TempBuffer = new byte[MemSize]; // Allocate the memory.
Field1->GetData(ByteBuffer,true);
A call to IsBlob() returns False so I have to use GetData(); The database
field is defined as VarBinary, Max=7800, allow nulls = no and key = no. At
any rate the returned data is fine.
This all works fine, however...
Now I want to modify the data, create a new record and write the "blob" back
into the database. All I can see seem to get is a record with the blob
field empty. I have tried many different things with only 1 successful
attempt. The problem is I don't know exactly the steps I used for that one.
Here is a sample of what I am trying:
TField * Field1 =
(TField*)CalibrationTemplates->FieldByName("TemplateData");
Templates->Append(); //TADODataSet
// Write the Modified data bact to a new record.
// ModBuffer is defined as shown above
Field1->SetData(ModBuffer,true);
Templates->UpdateRecord();
I populate other fields using FieldByName->AsString etc. The new record
sometimes will show up in the database, but the TemplateData is empty.
Any ideas?
thanks,
Kev
Technical Details
Message-ID:
<43e8e007$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!news.glorb.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10698b,99fd46b69bb7e384,start X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit From: "kev" <kev@isp.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: BLOB Field Date: Tue, 7 Feb 2006 12:03:12 -0600 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 65.116.27.178 Message-ID: <43e8e007$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1139335175 65.116.27.178 (7 Feb 2006 09:59:35 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!news.glorb.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail