How to use InsertRecord with TMyTable?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
frangarrob
Posts: 2
Joined: Thu 14 Apr 2011 12:01

How to use InsertRecord with TMyTable?

Post by frangarrob » Thu 14 Apr 2011 12:12

Hello, anybody knows how to use de InsertRecord command with the TMyTable component?

I don't know what arguments i need to put into de brackets. I need to insert a new empty record in my database with my application.

Form.TMyTable.InsertRecord();

When I make it, How can I go to this blank record and how can I put values into the fields and save it?

Thanks.

AndreyZ

Post by AndreyZ » Thu 14 Apr 2011 15:07

Hello,

You can use one of the following ways to insert records (the result will be the same):

Code: Select all

MyTable.Insert; 
MyTable.FieldByName('integer_field').AsInteger := 1;
MyTable.FieldByName('string_field').AsString := 'test';
MyTable.Post;
or

Code: Select all

MyTable.InsertRecord([1, 'test']);

Post Reply