Watch, Follow, &
Connect with Us
Public Report
Report From:    [ Add a report in this area ]  
Report #:  14242   Status: Closed
Borland.Eco.Persistence.SqlServer.StringAsNText.ValueToParameter TypeCast exception
Project:   Build #:  Update 3
Version:    1.0 Submitted By:   Alec Yu
Report Type:  Basic functionality failure Date Reported:  7/10/2005 11:51:14 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   227253
Resolution: Fixed (Resolution Comments) Resolved in Build: : 10.0.2041.10104
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Wrong code in Borland.Eco.Persistence.SqlServer.StringAsNText.ValueToParameter, parameter:IDataParameter is not of type BdpParameter but of type SqlParameter, and char[] not implementing IConvertible thus not accepted by SqlCommand as a right value type.

Wonder if the same error appears in Delphi 2005 as well.
Steps to Reproduce:
The steps to reproduce this error:
1. Create an ECO WinForm application

2. Put a PersistenceMapperSqlServer with corresponding SqlConnection with a proper connection string.

3. Specify Eco.PMapper properties of fields as StringAsNText

4. Create some eco objects with fields come with Eco.PMapper=StringAsNText

5. EcoSpace.UpdateDatabase
6. Crash with TypeCast exception
Workarounds
Created my own persistence mapper with its ValueToParameter method as:

procedure StringAsNText.ValueToParameter(value: TObject;
  parameter: IDataParameter);
begin
  parameter.Value := String(value);
  parameter.DbType:=DbType.String;
end;
Attachment
None
Comments

Alec Yu at 7/10/2005 12:09:19 PM -
Borland.Eco.Persistence.SqlServer.StringAsText.ValueToParameter should suffer from the same bug.

Server Response from: ETNACODE01