Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Database/Drivers/MS-SQL    [ Add a report in this area ]  
Report #:  2369   Status: Closed
INSERT INTO ... adds ASCII 0 to the end of all string fields
Project:  Delphi Build #:  4.453
Version:    7.0 Submitted By:   Eric Harmon
Report Type:  Basic functionality failure Date Reported:  9/16/2002 9:00:33 AM
Severity:    Serious / Highly visible problem Last Updated: 5/2/2003 12:58:35 PM
Platform:    All versions Internal Tracking #:  
Resolution: Fixed (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (10 Total Ratings)
5.00 out of 5
Total Votes: 8
Description
See steps for description of problem
Steps to Reproduce:
I have the following code:

  sql.CommandText := 'INSERT INTO User1 (Code, Description) ' +
    'VALUES (:Code, :Description)';
  sql.Params.ParamByName('Code').DataType := ftString;
  sql.Params.ParamByName('Description').DataType := ftString;

where sql is a TSQLDataSet, Code is defined as VARCHAR(12) and Description is defined as VARCHAR(50).

I run the following code:

  sql.ParamByName('Code').AsString := 'TEST';
  sql.ParamByName('Description').AsString := 'This is a test';
  sql.ExecSQL;

The row inserts correctly, but when I look at it in SQL Server Enterprise
Manager, I see a little square (non-printable character, it would seem) at
the end of each of the strings in the row (but only when I actually click in
the cell).  Trying to issue the following statement:

SELECT * FROM User1 WHERE Code = 'TEST'

fails to return any data.  If I enter the row data directly into SQL Server
Enterprise Manager, then I don't see the little square at the end of each
string field, and the query works correctly.

The "little" square appears to represent an ASCII 0.
Workarounds
None
Attachment
None
Comments

Andrew Mackie at 9/17/2002 2:16:08 AM -
Yes, I can re-create this. IMO, this is a critial/show-stopper bug

Brian Cook at 9/17/2002 6:47:17 PM -
Then *vote* for it!

Andrew Mackie at 9/18/2002 3:52:11 AM -
I would if my votes weren't already assigned to ADO bugs, which are more important to me than dbExpress bugs.

Brian Cook at 9/19/2002 11:10:58 AM -

OUCH!  You have my sympathy and I wish you the best of luck!

Andrew Mackie at 9/20/2002 12:51:37 AM -
Cheers. FWIW, it was reported in the newsgroups that this bug is fixed in the soon to be released SQL Server dbExpress driver update.

Tom Smith at 10/9/2002 2:48:14 PM -
I have the same problem and I can't go on with my program until this is fixed.

I will vote for this if it will help expedite the fix.  I assume by voting on an issue that it becomes more important to Borland.

Tom Smith at 10/9/2002 2:56:09 PM -
Oh yeah, I can simplify the steps to reproduce.

procedure TfrmMain.btnUpdateClick(Sender: TObject);
begin
  with dmMain do
  begin
    // CommandText := 'Select * from loans where LoanID = 1160'
    // a single record is retrieved from the database on Open
    ClientDataSet1.Open;
    ClientDataSet1.Edit;
    ClientDataSet1.FieldByName('Borrower').AsString := 'Smith';
    ClientDataSet1.Post;
    ClientDataSet1.ApplyUpdates(0);
    ClientDataSet1.Close;
  end;
end;

Ben Ziegler at 12/13/2002 11:29:13 AM -
Should this be closed now?

Andrew Mackie at 12/16/2002 1:43:10 AM -
I don't think it should be marked as Closed. It should be marked as Resolved.
(but then it hasn't even been Opened in the first place, but that's another story)

Ramesh Theivendran at 8/15/2003 8:32:39 AM -
The bug is fixed and released. I guess it should be closed.

T.Ramesh.

Jorge Vieira at 10/1/2003 2:53:43 AM -
Where can the new release be downloaded?

Stefan Jochens at 10/2/2003 4:16:20 AM -
I can't find the Update in the Download section for Delphi 7, too? It's very important for us, so can anyone tell me, where the update can be found?

Stefan Jochens at 10/2/2003 4:48:41 AM -
I just found out, that the MSSQL Update from 10 of October, 2002 is the mentioned Update.. Thank you

Server Response from: ETNACODE01