Thread View: borland.public.delphi.database.dotnet
2 messages
2 total messages
Started by Brigitte Spatz
Wed, 08 Nov 2006 13:49
Input string was not in a correct format
Author: Brigitte Spatz
Date: Wed, 08 Nov 2006 13:49
Date: Wed, 08 Nov 2006 13:49
31 lines
2408 bytes
2408 bytes
dr := dv.Item[bm.Position].Row; {dv = Dataview, bm = BindingManager}
dv.AllowNew := True;
for i := 0 to Length(arrComp) - 1 do {arrComp = array of Integer}
begin
bm.AddNew;
dv.Item[bm.Position].Row.ItemArray := dr.ItemArray;
for j := 1 to Length(dr.ItemArray) - 1 do //exclude ID
if j <> 13 then //exclude foreign key column
dv.Item[bm.Position].Row.Item[j] := dr.Item[j];
bm.EndCurrentEdit;
db.write_changes_ins(da, ds, true, 'ODM', sqlInsertCommand1); {this
is basically an Update command}
So I have read out an existing record - the dr. Then I have assigned
(almost) every attribute of that record to a new record in the same
table. One would think that this should work without problems (the ID
comes from a stored procedure in the sqlInsertCommand1 and works fine).
However, the table has five VarChar columns, three of which don't accept
the values passed to them - one gives "string was not recognized as a
valid Boolean", the other two "Input string was not in a correct
format." None of the date, integer, bit and text columns are affected,
it's only those three varchar columns. I understand that the first would
occur if a string was passed to a bit column and the second if a string
was passed to an integer column but they're all varchar(75)! If I copy a
record that has no entry in any of these three columns all is well.
Any ideas?
TIA.
Brigitte
Re: Input string was not in a correct format
Author: Brigitte Spatz
Date: Wed, 08 Nov 2006 14:55
Date: Wed, 08 Nov 2006 14:55
36 lines
2808 bytes
2808 bytes
Brigitte Spatz wrote:
> dr := dv.Item[bm.Position].Row; {dv = Dataview, bm = BindingManager}
> dv.AllowNew := True;
> for i := 0 to Length(arrComp) - 1 do {arrComp = array of Integer}
> begin
> bm.AddNew;
Please discard the following line, it was just one of many attempts of
getting it to work but never used at the same time as the code following it:
> dv.Item[bm.Position].Row.ItemArray := dr.ItemArray;
> for j := 1 to Length(dr.ItemArray) - 1 do //exclude ID
> if j <> 13 then //exclude foreign key column
> dv.Item[bm.Position].Row.Item[j] := dr.Item[j];
> bm.EndCurrentEdit;
> db.write_changes_ins(da, ds, true, 'ODM', sqlInsertCommand1); {this
> is basically an Update command}
>
> So I have read out an existing record - the dr. Then I have assigned
> (almost) every attribute of that record to a new record in the same
> table. One would think that this should work without problems (the ID
> comes from a stored procedure in the sqlInsertCommand1 and works fine).
> However, the table has five VarChar columns, three of which don't accept
> the values passed to them - one gives "string was not recognized as a
> valid Boolean", the other two "Input string was not in a correct
> format." None of the date, integer, bit and text columns are affected,
> it's only those three varchar columns. I understand that the first would
> occur if a string was passed to a bit column and the second if a string
> was passed to an integer column but they're all varchar(75)! If I copy a
> record that has no entry in any of these three columns all is well.
>
> Any ideas?
>
> TIA.
>
> Brigitte
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads