I have the following code, which works just as it should:
procedure verf.new_sanctuary(title: string; extTableID: integer);
begin
try
dv_sanct.AllowNew := true;
bm_sanct.AddNew;
with dv_sanct.Item[bm_sanct.Position].Row do
begin
Item['fld_cleared'] := false; // 3
Item['fld_company'] := compnr2.ToString;
Item['fld_Task'] := title;
Item['fld_exttableid'] := extTableID; // 4
Item['fld_extid'] :=
dv.item[bm.Position].Row.Item['fld_actionid'].ToString;
Item['fld_createddate'] := Tobject(DateTime.Today); // 1
Item['fld_createdtime'] := Tobject(DateTime.Now); // 2
Item['fld_reminder'] := Tobject(DateTime.Today);
end;
bm_sanct.EndCurrentEdit;
db.write_changes_ins(da_sanct,ds,true,'Massnahmen',
sqlInsertCommand1_sanct);
dv_sanct.AllowNew := false;
except
on ex: Exception do Messagebox.Show(ex.Message,
'Fehler beim Erstellen des neuen Datensatzes - Maßnahme konnte nicht
angelegt werden ');
end;
end;
Since this code is used in more than one form, I wanted to move it to a
separate unit. The uses clauses are all there, all I had to do was change
the declaration to
procedure new_sanctuary(title: string; extTableID, compnr2: integer;
bm_sanct, bm: System.Windows.Forms.BindingManagerBase;
dv_sanct, dv: System.Data.Dataview;
da_sanct: System.Data.SQLClient.SQLDataAdapter; sqlInsertCommand1_sanct:
System.Data.SQLClient.SQLCommand);
However, all of a sudden Delphi tells me it doesnt know Today and Now
(comments 1 and 2 in the code) at design time (but will compile these parts
no problem). It now also tells me that there are incompatible types: Object
and Boolean/Integer respectively (comments 3 and 4). If I replace false by
false.ToString or TObject(false) and extTableID by TObject(extTableID) it
will compile. So why was this not a problem when it was in the form from
where it was called? (And which is better false.ToString or
TObject(false)?)
TIA.
Brigitte
[Non-text portions of this message have been removed]
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/