Table
Table
Guys I have a Delphi 7 program and I use a Mytable together with Myconnection. Now the database is some 300,000 records and rising some 8000 a day.
So does the Table component load the complete table when its active? All I do is add a record every 10 seconds to the table so if it is loading the complete table, can I do this some other way as the database is remote and takes a bit to fire up.
Peter
So does the Table component load the complete table when its active? All I do is add a record every 10 seconds to the table so if it is loading the complete table, can I do this some other way as the database is remote and takes a bit to fire up.
Peter
-
AndreyZ
Hello,
The TMyTable component stores all records that you add to it in the memory (it allows working with these records). To avoid this, you can directly execute INSERT SQL statements using the TMyQuery component. Here is an example:using parameters:
The TMyTable component stores all records that you add to it in the memory (it allows working with these records). To avoid this, you can directly execute INSERT SQL statements using the TMyQuery component. Here is an example:
Code: Select all
MyQuery.SQL.Text := 'INSERT INTO DEPT(DEPTNO, DNAME, LOC) VALUES(1, ''TESTNAME'', ''TESTLOC'')';
MyQuery.Execute;Code: Select all
MyQuery.SQL.Text := 'INSERT INTO DEPT(DEPTNO, DNAME, LOC) VALUES(:deptno, :dname, :loc)';
MyQuery.ParamByName('deptno').AsInteger := 1;
MyQuery.ParamByName('dname').AsString := 'TESTNAME';
MyQuery.ParamByName('loc').AsString := 'TESTLOC';
MyQuery.Execute;Re: Table
I finally have found enough time to sit down and attack the problem. I guess this may really be a SQL statement problem and I am off searching google but:
I have 2 fields in the database that are an interger filed that auto incroments simply used as an ID and another field thats a time stamp
I am preaty sure I have to include these fields in the statement t get the correct number of fields but what do I do as a value? I seem to remember I can use NIL or NUll or something...
Peter
I have 2 fields in the database that are an interger filed that auto incroments simply used as an ID and another field thats a time stamp
I am preaty sure I have to include these fields in the statement t get the correct number of fields but what do I do as a value? I seem to remember I can use NIL or NUll or something...
Peter
Re: Table
hello,
If there are autoincrement fields in the table, or there are fields that have a default value, than such fields do not need to be specified in the fields list of the INSERT command, i.e. for the table
it is enough to call the following operator INSERT
the DEPTNO field will be filled in automatically
If there are autoincrement fields in the table, or there are fields that have a default value, than such fields do not need to be specified in the fields list of the INSERT command, i.e. for the table
Code: Select all
CREATE TABLE dept(
DEPTNO INT(11) NOT NULL AUTO_INCREMENT,
DNAME VARCHAR(14) DEFAULT NULL,
LOC VARCHAR(13) DEFAULT NULL
)Code: Select all
MyQuery.SQL.Text := 'INSERT INTO DEPT(DNAME, LOC) VALUES( ''TESTNAME'', ''TESTLOC'')';