?
Solved

kretzschmar ..I try to used Steam but failed.

Posted on 2002-03-30
6
Medium Priority
?
340 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
[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
  • 3
  • 2
6 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 1200 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

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

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…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

752 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