Solved

DBMemo and SQL server text

Posted on 1998-04-06
1
616 Views
Last Modified: 2008-02-01
DBMemo and SQL server text
The SQL database contains a table with text.
The text will be dbmemo in VCL.
UpdateSQL insert by "insert xtable('the_text')
values :thetext,the error told us
Field the_text is of an unsupport type.
Do we have any method to solve the problem? How?
Thank you.
0
Comment
Question by:mathematics
1 Comment
 
LVL 5

Accepted Solution

by:
ronit051397 earned 100 total points
Comment Utility
This is from Borland forum:

Subject:      Re: Blobs via SQL
                  From:         koterski@SPICEDHAM2borland.com (Steve Koterski)
                  Date:         1998/03/20
                  Message-ID:   <3514c411.13371795@forums.borland.com>
                  Newsgroups:   borland.public.delphi.database.sqlservers
                  [More Headers]


                  On Fri, 20 Mar 1998 14:56:51 +1300, Alistair Clethero <tarac@voyager.co.nz>
                  wrote:

                  >I am using a tquery to duplicate a record in a table 'n' times (it
                  >assigns a unique key via a parameter on each insert). The duplication
                  >works ok except when i try to duplicate one of the fields which is a
                  >text blob - the sql just refuses to like it. Can anyone tell me how i
                  >can insert a blob field using a tquery component, or at least point me
                  >to some SQL info on blobs. Most of the books show how you can use Delphi
                  >components with blobs, but not straight sql.

                  To insert BLOB or memo data through SQL, the BLOB or memo data must be
                  passed as a parameter. On the Delphi side, the parameter must be of type
                  ftBlob or ftMemo, whichever is appropriate for the column type. The data to
                  be inserted must be in the form of a PChar buffer (or equivalent). Prior to
                  executing the query with the UPDATE or INSERT statement, fill the parameter
                  by assigning the PChar buffer to the parameter.

                    procedure TForm1.Button1Click(Sender: TObject);
                    var
                      P: PChar;
                      s: Integer;
                    begin
                      with Query1 do begin
                        ParamByName('StrParm').AsString := 'ABC';
                        s := Memo1.GetTextLen + 1;
                        P := AllocMem(s);
                        try
                          FillChar(P^, s, #0);
                          Memo1.GetTextBuf(P, s);
                          ParamByName('MemoParm').AsMemo := P;
                        finally
                          FreeMem(P, s);
                        end;
                        ExecSQL;
                      end;
                    end;

                  **************************************************************************
                  Steve Koterski
                  Borland International, Inc.
                  http://www.borland.com/delphi
                  (Remove the "SPICEDHAM2" from the address. Death to spam-bots!)


This is from me (Ronit):
The SQL statement should look like this:

SQL.Text:='insert into MyTable values("aaa","bbb"',:P)';
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now