Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DBMemo and SQL server text

Posted on 1998-04-06
1
Medium Priority
?
639 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
[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
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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

610 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