DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Stephen has posted 20 posts at DZone. View Full User Profile

Using Command ADO In Delphi

11.12.2008
| 6380 views |
  • submit to reddit
        Usage example of TADOCommand in Delphi

function TfrmCreateEdit.UpdateBooking(dbName: TADOCommand ; tblName : string ; RecID : integer) : boolean;
begin
  Result := False;

  with dbName do begin
      CommandText := 'UPDATE ' + tblName
      + ' SET '
      + ' Title = ''' + strTitle + ''''
      + ' ,FirstName = ''' + strFirstName + ''''
      + ' ,LastName = ''' + strLastName + ''''
      + ' ,JobTitle =  ''' + strJobTitle + ''''
      + ' ,Department =  ''' + strDepartment + ''''
      + ' WHERE RecID = ' + IntToStr(RecID);

      try
         memoDebug.Text := CommandText;
         Execute;
         Result := True;
      except
         Result := False;
      end;

  end;
end;