Solved

kretzschmar ..I try to used Steam but failed.

Posted on 2002-03-30
6
336 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 115
Intraweb download file link ? 1 155
Run video youtube webbrowse 10 65
How to insert .png images to TClientDataSet .cds file? 2 31
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…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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