Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Bitmap field

Posted on 1998-09-01
5
Medium Priority
?
362 Views
Last Modified: 2013-12-03
How can I insert a bitmap in a TImage component to a SQL
Server 6.5 database image field using TQuery.

Please send me a piece of code

thanks in advance
0
Comment
Question by:Cumhur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:vladika
ID: 1338340
Something like its

SQL: insert into Images(Image) values(:image)

Code:
procedure TForm1.Button1Click(Sender: TObject);
var Stream: TStream;
begin
  Stream := TMemoryStream.Create;
  try
    Image1.Picture.Bitmap.SaveToStream(Stream);
    Stream.Position := 0;
    Query1.ParamByName('Image').LoadFromStream(Stream, ftBlob);
  finally
    Stream.Free;
  end;
  Query1.ExecSQL;
end;

0
 

Author Comment

by:Cumhur
ID: 1338341
Finally I did it.... Thanx for your help. I was going mad, because i've been struggling with stream, memorystream,loadfromstream,...etc. for two days.
I was giving parameter as query1.params[0].AsBlob:= stream
That was my problem. i couldn't think of giving parameter in that way, ( two days...:))
when i gave parameter as above, it gave errors of incompatible types string and tstream. I typecasted it as string(stream)....whatever... Thanx for help.... Valla, if i had 200 points, i would give all for this answer (as i said 2 days...)...
0
 

Author Comment

by:Cumhur
ID: 1338342
Finally I did it.... Thanx for your help. I was going mad, because i've been struggling with stream, memorystream,loadfromstream,...etc. for two days.
I was giving parameter as query1.params[0].AsBlob:= stream
That was my problem. i couldn't think of giving parameter in that way, ( two days...:))
when i gave parameter as above, it gave errors of incompatible types string and tstream. I typecasted it as string(stream)....whatever... Thanx for help.... Valla, if i had 200 points, i would give all for this answer (as i said 2 days...)... But why did you add answer as a comment? Answer then let me give you 10 points (which all i have)
0
 
LVL 3

Accepted Solution

by:
vladika earned 40 total points
ID: 1338343
Ok. This is my "official" answer
0
 

Author Comment

by:Cumhur
ID: 1338344
And the points goes to...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question