You are here:

Delphi/Save Jpeg to MS SQl Server 2000

Advertisement


Question
i want Save/load Jpeg image to/from MS SQl Server 2000 in/from a table From Delphi 10(2005)
by coding and only SQL (TableName:MYTable FieldName:MyImage)
1- Whouldyou plz write me Who I can do it by ADOCommand
i dont want use TBlobField

Answer
hello,

what is the reason behind "don't want to use blob field"? it is some personal taste, or you have a rationale? because TBlobFields are the standard way of dealing with binary or blob database types.

what other options you have? when you save to the database, you can of course use simple SQL statements, assembled at runtime, without parameters. i don't know MySQL syntax, but for example in Sybase, you can write:

insert into MyTable (..., MyImage, ...)
 values (..., 0x5F6600007e01..., ...)

it will be a loooong hexadecimal code there, but if you don't run into some limitations of the statement size, it should work.

retrieving such a value is harder. if you have some function that converts blobs to hexadecimal strings, you can later transform it back to binary data with delphi code. but it seems an extremely roundabout and dirty way to go.

maybe if you tell me what is your actual goal, and why blob fields are to be avoided, i can tell you some better approach than the above ones.

regards,
K

Delphi

All Answers


Answers by Expert:


Ask Experts

Volunteer


Krisztián Pintér

Expertise

I`m good at database design and programming, using windows API, multithreaded programming, inter-process commucitations, dll-s and packages. I`m experienced with OLAP and SQL. I also have some COM/ActiveX knowledge and component writing skills. Weak sides: internet, multimedia, graphics. Please don`t ask questions that can be easily looked up in the reference manual, or requires hours of debugging, what appears to be your task. Conceptional or methodological questions are the most welcome ones.

Experience

I have 8+ years work experience with Delphi. My primary area is Information Systems Programming. With a small team, we designed and implemented large scale Information Systems to pharmaceutical factories and parking companies.

©2012 About.com, a part of The New York Times Company. All rights reserved.