1

I wanted to insert several lines to database using DBGrid. on my query, I selected for example:

select * from cust where id='0';

that code will return no record at all so my dbgrid will not show anything but an empty row. Now I wanted to put in data in empty row with new data. However my data needs 2 lines from dbgrid. I wanted dbgrid creates an empty row right after I fill last column in first row. How do I code that? (without inserting the first row data because later I'll insert everything with a seperated button). thanks!

mizkyd
  • 75
  • 1
  • 11

1 Answers1

0

you can add records in your table with NULLin each column.
For example, suppose the table where the DBGrid is binded to has 4 columns, than you can try this code to add empty records

Query1.InsertRecord([null, null, null, null]);

With this code you can add as many empty records as you like in the DBGrid
That is assuming that the query component you are using supports the InsertRecord method...

GuidoG
  • 11,359
  • 6
  • 44
  • 79