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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Operation must be performed on the current session" Error

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
I have created some paradox tables through the Database Desktop. I'm now trying to connect to these tables and I'm having problems.

I keep getting the error "Operation must be performed on the current session" when I try to connect to the database. If I have the TDatabase component on the main form, if after getting this error I try a second time, the form opens!

I have frmMain with a TMainMenu component.

I have frmVolunteerInfo that I would like to use to show and enter new volunteers into the tables.

I have an ODBC connection to the directory where all the tables are saved.

What is the easiest and correct way to set up the database/table/query components with local Paradox tables?

Please Help!!!

here's all I'm trying to do:

Code:
procedure TfrmMain.AddNew1Click(Sender: TObject);
begin
  with TfrmVolunteerInfo.Create(frmMain) do
  begin
    Show;
  end;
end;

leslie
 
The "correct" was is to have your database/table/query components in a DataModule.

This helps you to separate the database part of your application from the presentation (forms and so on) part of your application which should make your application more robust and easier to maintain.

The datamodule is usually autocreated when your program starts up.

I would suggest that the easiest way to access local Paradox tables is by using the BDE rather than using ODBC. However, you'll find some people on this forum who dislike the BDE. The problems with the BDE seem to come in a multi user environment. But if your Paradox tables are local and not shared by another user then the BDE should be okay and significantly faster than using ODBC but maybe this doesn't matter in your application.


Andrew
Hampshire, UK
 
OK, I'll give that a try today.

I did try using a datamodule, but got the same error.

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top