BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ODBCExpress Question

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Randal Ferguson
Guest





PostPosted: Sun Jan 25, 2004 10:36 pm    Post subject: ODBCExpress Question Reply with quote



All,

Sorry for posting this here. I posted in the ODBCExpress newsgroup and
haven't gotten a response and my question may not be related to that product
in particular. I'm having a problem with a small program that reads an
Access Database and saves an image in an OLE field to a file. The following
is the code in question:

procedure Select();
var
Hstmt: THstmt;
Hdbc: THdbc;
begin
Hdbc := THdbc.Create(nil);
try
Hdbc.DataSource := 'AccessHandheld';
Hstmt := THstmt.Create(nil);
try
Hstmt.hDbc := Hdbc;
Hstmt.SQL := 'SELECT pic1 FROM TestPic';
Hstmt.Execute();
if Hstmt.FetchNext() then
begin
Hstmt.ColMemory[2].SaveToFile('Pic1.bmp');
end;
finally
Hstmt.Free();
end;
finally
Hdbc.Free();
end;
end;

The program bombs with an access violation on the ColMemory.Save method. Is
there something else I should be doing? I can open the table and view the
image in Access, it's a small bitmap. I'm new to Delphi so forgive my
ignorance.

Thanks,
Randal Ferguson



Back to top
Randal Ferguson
Guest





PostPosted: Mon Jan 26, 2004 7:05 pm    Post subject: Re: ODBCExpress Question Reply with quote



All,

I got it, thanks anyway.

Randal Ferguson

"Randal Ferguson" <rdfsoft (AT) cs (DOT) com> wrote

Quote:
All,

Sorry for posting this here. I posted in the ODBCExpress newsgroup and
haven't gotten a response and my question may not be related to that
product
in particular. I'm having a problem with a small program that reads an
Access Database and saves an image in an OLE field to a file. The
following
is the code in question:

procedure Select();
var
Hstmt: THstmt;
Hdbc: THdbc;
begin
Hdbc := THdbc.Create(nil);
try
Hdbc.DataSource := 'AccessHandheld';
Hstmt := THstmt.Create(nil);
try
Hstmt.hDbc := Hdbc;
Hstmt.SQL := 'SELECT pic1 FROM TestPic';
Hstmt.Execute();
if Hstmt.FetchNext() then
begin
Hstmt.ColMemory[2].SaveToFile('Pic1.bmp');
end;
finally
Hstmt.Free();
end;
finally
Hdbc.Free();
end;
end;

The program bombs with an access violation on the ColMemory.Save method.
Is
there something else I should be doing? I can open the table and view the
image in Access, it's a small bitmap. I'm new to Delphi so forgive my
ignorance.

Thanks,
Randal Ferguson






Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.