Article View: borland.public.cppbuilder.database.ado
Article #1283Re: Storing images from IStream based object into MSSQL through ADO
From: Viatcheslav V. Vassiliev
Date: Tue, 14 Sep 2004 09:00
Date: Tue, 14 Sep 2004 09:00
47 lines
2614 bytes
2614 bytes
It seems that easest way for you is to use native ADO objects. In IDE menu
select "Project\Import type library" and import
"Microsoft ActiveX Data Objects 2.X Library". You will have classes to work
with ADO.
The code for BCB ADO objects is:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOConnection1->ConnectionString = WideString("Provider=SQLOLEDB;"
"Integrated Security=SSPI;Initial Catalog=XXX;");
ADOConnection1->Connected = true;
ADOCommand1->Connection = ADOConnection1;
ADOCommand1->CommandText = WideString("INSERT INTO ImageTest (ImgColumn)
VALUES (?)");
ADOCommand1->Parameters->Refresh();
ADOCommand1->Parameters->Items[0]->LoadFromFile(ExtractFilePath(ParamStr(0))
+ "img.jpg", ftBlob);
ADOCommand1->Execute();
}
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Brad Arant" <barant@barant.com> �������/�������� � �������� ���������:
news:41460f24$1@newsgroups.borland.com...
> I have many examples of using a recordset to store an image into MSSQL
using
> a CRecordset object but I am trying to do this using BCB6.
>
> The question is what is the best way to do this and is there any code
> examples anywhere that can help me? I have done this successfully in VC++
> using the ADO.Stream object but for the life of me I can't figure out the
> details in BCB using the TADO objects.
>
>
>
>
>
Technical Details
Message-ID:
<4146b322@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41460f24$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,9b4a015d247fa72d X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <41460f24$1@newsgroups.borland.com> Subject: Re: Storing images from IStream based object into MSSQL through ADO Date: Tue, 14 Sep 2004 13:00:17 +0400 Lines: 49 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: 213.234.218.42 Message-ID: <4146b322@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1095152418 213.234.218.42 (14 Sep 2004 02:00:18 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail