Article View: borland.public.cppbuilder.database.ado
Article #1189Re: Storing images from IStream based object into MSSQL through ADO
From: Brad Arant
Date: Tue, 14 Sep 2004 18:46
Date: Tue, 14 Sep 2004 18:46
60 lines
3139 bytes
3139 bytes
I was able to adopt your methods there using the parameter object using
standard BCB6 ADO objects and did not need to do the import. Thanks for the
tip. Much appreciated.
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
news:4146b322@newsgroups.borland.com...
> 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:
<41473c38$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!c03.atl99!news.usenetserver.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<41460f24$1@newsgroups.borland.com> <4146b322@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,9b4a015d247fa72d X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII Reply-To: "Brad Arant" <barant@barant.com> From: "Brad Arant" <barant@barant.com> Newsgroups: borland.public.cppbuilder.database.ado References: <41460f24$1@newsgroups.borland.com> <4146b322@newsgroups.borland.com> Subject: Re: Storing images from IStream based object into MSSQL through ADO Date: Tue, 14 Sep 2004 11:46:38 -0700 Lines: 62 Organization: BARANT Technologies X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 66.12.94.132 Message-ID: <41473c38$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1095187512 66.12.94.132 (14 Sep 2004 11:45:12 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!c03.atl99!news.usenetserver.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail