Adding a New Record
Posted: Thu 04 May 2006 19:10
Hello,
I am evaluating these components with Builder 6.0 and I am trying to add a new record onto a table.
The table Site_ID has these fields.
ID which is a int, the primary flag and is set to auto increment
Name varchar(20)
Notes text
Num int
I was trying to use some of the methods in TMyTable like
Table1->Insert();
Table1->FieldVaues["Name"] = Edit1->Text;
Table1->FieldVaues["Notes"] = Edit2->Text;
Table1->FieldVaues["Num"] = 5;
Table1->Post();
But I seem to get errors when I try it this way.
Am I missing some steps? Or do I need to do it with SQL statements in a TMyQuery component?
Also how do I ensure that ID will be given the next number? I was under the impression MySQL does that automatically?
Thanks in Advance
---Dave
I am evaluating these components with Builder 6.0 and I am trying to add a new record onto a table.
The table Site_ID has these fields.
ID which is a int, the primary flag and is set to auto increment
Name varchar(20)
Notes text
Num int
I was trying to use some of the methods in TMyTable like
Table1->Insert();
Table1->FieldVaues["Name"] = Edit1->Text;
Table1->FieldVaues["Notes"] = Edit2->Text;
Table1->FieldVaues["Num"] = 5;
Table1->Post();
But I seem to get errors when I try it this way.
Am I missing some steps? Or do I need to do it with SQL statements in a TMyQuery component?
Also how do I ensure that ID will be given the next number? I was under the impression MySQL does that automatically?
Thanks in Advance
---Dave