?
Solved

DBMemo and SQL server text

Posted on 1998-04-06
1
Medium Priority
?
645 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 200 total points
ID: 1361308
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

850 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