karl Jonson 0 Posted August 5, 2022 I have a DBEdit linked to a integer-field in a table & everything works fine but now I'd like to allow user to enter many integers separated by commas in the DBEdit. So when user types 1,2,3 three records are inserted in the table & without the posting failing. How can I achieve this ? TIA Share this post Link to post
PeterBelow 238 Posted August 6, 2022 17 hours ago, karl Jonson said: I have a DBEdit linked to a integer-field in a table & everything works fine but now I'd like to allow user to enter many integers separated by commas in the DBEdit. So when user types 1,2,3 three records are inserted in the table & without the posting failing. How can I achieve this ? TIA Not with a TDBEdit. Databound controls are typically linked to one single record (the current record in the dataset); using them the typical workflow is: add new record - enter data for this record - post the record to the dataset. You have to use an unbound TEdit in your case and dissect its content in code, e.g. when the user leaves the control (OnExit event), or when he pushes a button. Pseudo code: var LList: TStringlist; N, LValue: integer; begin LList := TStringlist.Create; try LList.StrictDelimiter := True; LList.Commatext := Edit1.Text; for N:= 0 to LLIst.Count - 1 do begin if TryStrToInt(Trim(LList[N]), LValue) then begin add record to dataset store LValue into the dataset field post the record end; {if} end; {for} finally LList.Free; end; end; 1 Share this post Link to post