[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Using Sessions

Posted on 1998-07-31
16
Medium Priority
?
164 Views
Last Modified: 2010-04-04
I would like someone to explain me quite detailed how to manage with sessions in Delphi 3.
My problem is I have an MDI application and want to create as many child-windows as users wants. Every child-window must have a session in order to be independant from the other child-windows. Resuming, every child-window is like a separate application.
Thanks.
0
Comment
Question by:quique
  • 6
  • 5
  • 2
  • +3
16 Comments
 
LVL 2

Expert Comment

by:odessa
ID: 1359352
I don't understand very clear your question because the TSession in delphi only manage multiple access to DataBases (same or different), tell me more,
Zhasmin!
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1359353
Hi guys. Zif, maybe he means threads? Threads do require a detailed explenation...
0
 
LVL 1

Expert Comment

by:jecksom
ID: 1359354
Hello,
var
  Form1: TForm1;
  myforms:array [0..65535] of Tcustomform;
  nd:word;

procedure TForm1.Button1Click(Sender: TObject);
begin
myforms[nd]:=Tcustomform.Createnew(self);
myforms[nd].Show;
inc(nd);
end;

Is it ?
PS: Sessions ? Database sessions you mean ?


0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
LVL 1

Author Comment

by:quique
ID: 1359355
I need to explain a bit more my question.
My idea is to make an application that manages with a database in order to store and retrieve information to the user.
Until this point this is a simple database application.
But I have thought, it would be more useful and powerful if I could make MDI. But I have found a problem at this point.
I know how to make MDI applications and how to manage with child and parent windows, so this is all quite clear.
The problem appears when I try to do the following:
in my application the user can open as many child windows as he wants to. Every child windows will have TDBEdits connected to a TTable in order to show information from the database and will also have a TDBNavigator and some buttons to make some actions such as deleting, sorting, finding, etc. If we asume this, then the user can have 2 child windows opened at the same time with information of the same Table (for example, he has opened 2 windows, every one with information about a client in his business). If the user moves across one window, then data on the other window gets moved because they are connected to the same table in the same database. My problem is that I don't want this to happen. I want every window connected to a table independant from other windows that the user will open, even if they are connected to the same table. I have heard that TSessions can manage with this problem. If so, please tell me how to do it. Or if there is another way to do that, please tell it to mee too.
Looking forward to hearing from you, regards ....
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1359356
You just need to add a set of TTables for each MDI windows and point them to the same table instead of using a common TTable.
Don't worry about TSessions right now, unless you want to work in threads, you can normally do without them..
0
 
LVL 1

Author Comment

by:quique
ID: 1359357
But, BlackMan, if I do what you tell me, would I have to repeat code? Would I have to do several kinds od MDI windows in order to show different data from different tables?
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1359358
Is it the same windows that you show a number of times?
If you put the TTables on the MDI Child form, them there will be a instance for each windows and you don't have to repeat code..
0
 
LVL 1

Author Comment

by:quique
ID: 1359359
Ok, BlackMan, but you told me about a set of TTables for each MDI and then point them to the same table. Does this mean I have a Datamodule with 'real' tables and then I point the instances of the MDI windows to these 'real' tables? How can I do this? Is it something like this?:

I have a Datamodule called DM1 with a table called Table1.

I have a MDI window with a table called TableMDI.

Shall I put on the OnCreate event of the MDI window:

Tform1.Oncreate ...
begin
    TableMDI := DM1.Table1;
end;

Is this right? If so, I have tried it and it doesn't work (obviously I have Attached a datasource to the TableMDI in order to show data on TDBEdits).
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1359360
Things get a bit more complicated if you have a DataModule with some logic in.. There is a unit called CloneTable, which you might want to try. This enable you to make a clone of the table in the DataModule each time you create a MDI child. Check http://www.bhnet.com.br/~demian/
What I meant in my previous comment, was that you could put a TTable on your MDI form and then set the properties on that one instead of using a DataModule.
0
 
LVL 1

Author Comment

by:quique
ID: 1359361
C
0
 
LVL 2

Expert Comment

by:333
ID: 1359362
Maybe you can just add some variable to each MDIChild window with the value of TTable.RecNo. So when the user changes something, just move to the right record.

Can't you use a simple TEdit instead of TDBEdit?

Or mybe TQuery?
0
 
LVL 2

Expert Comment

by:333
ID: 1359363
It's me again...

quique, did you really need DataModule? If not, you can do so:
If you have a MDIChild with TableMDI, then in OnCreate event of MDIChild write

procedure TForm1.FormCreate(Sender: TObject);
begin
  with TableMDI do begin
    TableName:='C:\Test.db';
    TableType:=ttParadox;
    Exclusive:=false;
    ...
    {Some other values like IndexNames, Filter, etc.}
    ...
    Open; {you have a table}
  end;  
end;


0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1359364
quique, are you still there??
0
 
LVL 1

Author Comment

by:quique
ID: 1359365
Blackman, I need an answer in order to give you the points, not a comment!
0
 
LVL 7

Accepted Solution

by:
BlackMan earned 600 total points
ID: 1359366
Things get a bit more complicated if you have a DataModule with some logic in.. There is a unit called CloneTable, which you might want to try. This enable you to make a clone of the table in the DataModule each time you create a MDI child. Check http://www.bhnet.com.br/~demian/ 
What I meant in my previous comment, was that you could put a TTable on your MDI form and then set the properties on that one instead of using a DataModule.
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1359367
I wasn't sure if you were satisfied :-)
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question