Solved

kretzschmar ..I try to used Steam but failed.

Posted on 2002-03-30
6
330 Views
Last Modified: 2010-05-18
hi...HELP
  look at this:

 ParamByName('Content').asBlob:=LString;

in this case ,the LString size is over 256 charactors.when storing LString to 'Content',delphi trimed the charactor >256.....
How to store the whole LSting to 'Content'???

Actually, this problem occurs when I convert a table from
FoxPro 2.6 Dos version to MS Sql Server 7.0.
the data field "Content" in Foxpro is MEMO.
the data field "MSSqlContent" in MSSQL is VarChar(2000).
when i use
 ParamByName('MsSqlContent').asString:=Query1Content.asString;

it shows Error Message the is
"BDEengine ERROr...General SQL Error..."
"Unclosed quotation mark before the Character string 'XX?)
Line 1:Incorrect Syntax Error near 'XX?) "


So I use ParamByName('MSSQLContent').asBLOB:=....; instead.
but the result is just as the question posted at first.

Now  I find that the problem is the LENGTH of the fox MEMO field.....
I can't save String( lenght>255) into the SQL SERVER 7.0 VARCHAR(2000) field ???????????????
WHY????????????????????????????????
HOW TO put a string ( length>255) int to the MS SQL SERVER 7.0 VARCHAR field ..
I try to used Stream but it failed again, cause ONLY 255 character saved into the VARCHAR(2000) field
,other Character (>255) has been Trimmed!!!
0
Comment
Question by:windyui
  • 3
  • 2
6 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 300 total points
ID: 6908559
var m : tmemorystream;
begin
  m := tmemorystream.create;
  TBlobField(foxprotable.fieldByName('Memo')).savetostream(m);  //assuming the table is open and on the record
  m.position := 0; //spool back
  //1->if you have a ttable on your mssql-side
  mssqltable.edit;
  TBlobField(mssqltable.fieldbyname('FieldName')).loadfromstream(m);
  mssqltable.post;
  //2->if you have a query with parameters, the parameter should defined as blob-parameter
  updatequery.parambyname('PramaName').loadfromstream(m);
  updatequery.execsql;
  m.free;
end;

hope this helps

meikl ;-)
0
 

Author Comment

by:windyui
ID: 6911734
HELP,
   I guess the problem is the BDE!!!I just try to input charactor over 256 into the Field(VARCHAR(2000)) directly inside BDE but failed!!!!Even I used CHAR(2000) I can't input any char over 255.
    I can't input charactor length over 255 inside the BDE.
What's the problem???I use Delphi 4.0 and MSSQL 7.0.
    I have tried all the possible ways to ExecSql by all failed, includes String and Stream.When I used string,General SQL Error occured. When I used Stream ,It trim the Charactor length over 255.
    Is it a bug of BDE???????????/or sth else I don't know.
I Do need to solve this problem ,PLEASE HELPME. >_<
                                                winyui T_T
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6912800
? a varchar(2000) should be recognized as blob-field by the bde

isn't it so?

meikl ;-)
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:windyui
ID: 6912962
^^GREAT!! U r right!!
  My friends said that the problem is about the MS SQL driver for BDE.It can't deal with charactor length over 255,or the charactor will be CUT to 255.
  is there any other way to save the char(over 255) to a MSSQL field???????
(Divide the field to 8 Char(255)??????????)  >_<
  I have tried your TMemoryStream...But!! It Cut again! >_<
TOO BAD~~~~~~~!!! T_T
  Thank you for helping me so much.
                                     Windyui.
0
 

Expert Comment

by:jonnyfive
ID: 6915484
I would suggest to use ADO instead the BDE in this case.

Regards, Jonny...
0
 

Author Comment

by:windyui
ID: 6917383
...
Thanks all. especial kretzschmar ,thank you very MUCH.
the porblem is solved when I use ODBC.
  SORRY!!! I have not experience that I should not use BDE directly.!!!
  THANK YOU For your help.
  ^_^
  thankyou.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

17 Experts available now in Live!

Get 1:1 Help Now