Solved

TSession and Login Dialog

Posted on 1998-02-25
19
487 Views
Last Modified: 2010-04-06
How do I prevent from the Login Dialog to be displayed when opening a table, connected to a TSession.
I know how to do it with TDatabase, but the TSession creates a new one on the fly, when the table is opened and I can't access that TDatabase prior table opening.
0
Comment
Question by:ronit051397
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
  • 5
19 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359774
Hi ronit,

Use AddPassword property :

Session.AddPassword('ASecret');

If no password exists you'll get a dialog.

Regards, Zif.
0
 
LVL 5

Author Comment

by:ronit051397
ID: 1359775
Now I get the dialog twice. I don't want to see it at all.
This is my code:

Session1.AddPassword('informix');
Session1.open;
Table1.open;

Any other suggestions?
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359776
What about coding the OnPassword event?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Author Comment

by:ronit051397
ID: 1359777
I tried with no success.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359778
What sort of database tables are you using?
0
 
LVL 5

Author Comment

by:ronit051397
ID: 1359779
INFORMIX. When we use Far database, before connecting, we get login dialog. I don't want this dialog to be displayed. I want to put the password in the code.
0
 

Expert Comment

by:bijoyn
ID: 1359780
Ronit,

This is what I tried Out -

I dropped a TDatabase component and set its LoginPrompt property to False. In the Params property, I added the following statements-
username='Name Of The User'
password='Password'.

Then I dropped the TSession Component on the form and set the KeepConnections property to true. In the Session property of the TDatabase component, I assigned the newly dropped TSession component name.

By doing this the dialog does not come up at all.

Does this answer your question ?.

Bijoy.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359781
Yes, for each TSession you need another TDatabase component.
0
 

Expert Comment

by:bijoyn
ID: 1359782
Ronit,

U can link multiple databases to one TSession component and specifically open each database by using the Session.Opendatabase('DatabaseName') statement.

Bijoy.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359783
Bijoy, strange I thought that for multi-threaded applications each tsession needs another tdatabase. Well, if not I learned again something. Great.
0
 
LVL 5

Author Comment

by:ronit051397
ID: 1359784
I create TSessions on the fly and open Tables via these sessions.
When a Table is opened via a TSession, Automatically a temporary TDatabase is created by that session and a connection is established.

In my case in each new connection, that bothering dialog apears.
To prevent it I need to set The new TDatabase parameters as Bijoy says, but the problem is that I can't access it before the connection, because it is created internaly by the TSession, so what I do is Create my own, prior the Table connection as follows:

begin
  Session1.Open;
  with TDatabase.Create(nil) do
  begin
    LoginPrompt:=False;
    Params.Values['PASSWORD']:='informix';
    Temporary := True;
    DatabaseName:='RRAServer';
    KeepConnection:=Session1.KeepConnections;
    SessionName := Session1.SessionName;
  end;
  Table1.SessionName:=Session1.SessionName;
  Table1.open;//here where the dialog should apear but now it doesn't
end;

There is no need to free the TDatabase, because it was declared as Temporary and will be freed automatically when that session closes.

Thank you all, I don't know who should get the points ZifNab or Bijoy, what do you think?
0
 

Expert Comment

by:bijoyn
ID: 1359785
Hey Ronit,

MAybe ZifNab and Myself can split the points. What say ZifNab ?.

Cheers,

Bijoy
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359786
Sure no, problem. But if Bijoy wants them all, he also may get them (maybe easier).

Regards, Zif.
0
 
LVL 5

Author Comment

by:ronit051397
ID: 1359787
I don't know how to split the points, So since Bijoy was closer to the answer, then he/she should get the points.
Sorry ZifNab, I'll have to reject your answer.
Bijoy post some extra tips as an answer and you'll get the points.
0
 

Expert Comment

by:bijoyn
ID: 1359788
Zif,

I am not greedy u know. Knowing u people seems better than the points that I receive.

Bijoy.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359789
Hi all,

Same for me Bijoyn, learning and knowing of each other is much more than just earning these points. Have totally no problem with you getting the points, because you really deserve them, besides, heck, why do we need points.

Regards.
c.u. Zif.
0
 
LVL 5

Author Comment

by:ronit051397
ID: 1359790
Hi every body,
There is no need to be the Pope. This is some kind of Game/Competition, which one loses and the other wins, no big deal. With This points you can then ask your own questions. So?

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359791
? Ronit. You can't ask questions with points earned for a correct answer. Or am I wrong? Besides, you're right it makes things a little bit funnier to make a sort of competition of it. But for that we don't have to pull each others hear out ;-)
0
 

Accepted Solution

by:
bijoyn earned 50 total points
ID: 1359792
Hi Zif & Ronit,

Lets Close This. I personally would like to see this question off the list.

Cheers,

Bijoy
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

623 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