Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB Tools

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 06-14-2010, 02:21 PM
morne_kobus morne_kobus is offline
Junior Member
 
Join Date: Jun 2010
Posts: 1
Question What is the correct way to open and close a access database in Delphi?

I am using TADOTable, TDataSetProvider and TDataSource for each table in my access database. The application need to typical work like word or excel, in that when you open the program you start with a clean file, and then you can save this file, or load a already saved one.
I am using the following code to load a database file, but clearing I am missing something:
If OpenDialogSite.Execute Then
Begin
Dir := ExtractFilePath( Application.ExeName );
ADOTablePanels.Close;
ADOTableSite.Close;
WorkingFileName := Dir + 'DBs\Site.mdb';
OpenFileName := OpenDialogSite.FileName;
CopyFile(PChar(OpenFileName),PChar(WorkingFileName ),False);
ADOTablePanels.Open;
ADOTableSite.Open;
End;

When I try to change data in the tables afterward, I get the error “Row cannot be located for updating”
What am I missing, or doing wrong?
Reply With Quote
  #2  
Old 06-16-2010, 01:46 AM
kbboykin kbboykin is offline
Senior Member
 
Join Date: May 2005
Posts: 371
Default

That usually means you have either not applied updated data or refreshed the database.
Reply With Quote
  #3  
Old 09-27-2011, 04:49 PM
Legomus Legomus is offline
Junior Member
 
Join Date: Sep 2011
Posts: 9
Default

I usually link the ADOtabel with a Datasource and a DBGrid .. set the adotabel active = true .. if you want to edit it the DBNavigator has a easy edit button
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:50 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.