Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBGrid problem

Status
Not open for further replies.

MLNorton

Programmer
Nov 15, 2009
134
US
I understand that a DBGrid is directly connected to the underlying dataset. In my cade an Access database as an ADOTable. I understand that any input or change to a value in the DBGrid is immediately changed in the underlying dataset.

I have an ADOTable (Access) with each record having seven fields, four contain data and the remaining three fields are empty. I enter data into one of three blink fields directly into the DBGrid. No matter how many values I enter, the data in the last record is not recorded. If after the last entry I click on a new blank record with no data entry, the list entry is recorded.

What is the problem and what is the solution?
fields
 
Not sure, and not tested, but I believe...

procedure TForm1.DBGrid1ColEnter(Sender: TObject);
begin
ADOTable.Edit;
end;

procedure TForm1.DBGrid1ColExit(Sender: TObject);
begin
ADOTable.Post;
end;

Then again, I'm used to connecting to MSSQL using a TADOQuery, and I don't like the DBGrid for exact reasons like this. Also, if you have an older version of Delphi such as 7, try using the mouse scroller in the grid. It will drive you nuts.



JD Solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top