[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Database

Posted on 2004-03-31
6
Medium Priority
?
181 Views
Last Modified: 2010-04-05
I have a SQL query connected to a data source and to a database component on a form.
I have turned the login prompt to false on the database component so I dont receive a login box when I activate the query.

My problem is that I still receive a login box even though I have carried out the above. Am i missing something?

I am using Delphi 5 Professional and the query is performing a select on a SQL Server system.

Any suggestions would be great.
Thanks
Sct
0
Comment
Question by:SCOTT78
6 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10723666
is your query bound to the tdatabase?
(property databasename -> select here the name of the tdatabase)

meikl ;-)
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 120 total points
ID: 10723693
Thats because your database requires a login, even though you shut it off, by telling the LoginPrompt = false


Try passing the login info using the Params property of the database.

You can set it at design time,

or

runtime

here is an example:

{------------------------------------------------------------------------------}
function TAdmin_DataModule.Connect_Database(aServer, aUserName,
aPassword : string; aDatabase : TDatabase) : Boolean;
var
 TmpStrList : TStringList;
begin
 TmpStrList := nil;
 Result := True;
   try
    TmpStrList := TStringList.Create;
    TmpStrList.Add('SERVER NAME=' + aServer);
    TmpStrList.Add('USER NAME=' + aUserName);
    TmpStrList.Add('PASSWORD=' + '');
    aDatabase.Params.Assign(TmpStrList);
   finally
    try
     aDatabase.Connected := True;
     Result := aDatabase.Connected;
     TmpStrList.Free;
    except
     Result := False;
     aDatabase.Connected := False;
     TmpStrList.Free;
    end; {try except}
   end;

end;
0
 
LVL 11

Expert Comment

by:calinutz
ID: 10727489
You probabely placed the Database component on a form ... and not on a DataModule and you probabely placed another query component on another form. You should place all the data acces components (query, table, database, datasources) in a DataModule and try to see if you get the login prompt.
 Cheers.
0
Industry Leaders: 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 11

Expert Comment

by:calinutz
ID: 10727501
And of course you must obviously link the form that uses the query with the data module.

Calinutz
0
 

Expert Comment

by:meadorj
ID: 10736061
Also if your dbms requires a uname and password then you will have to set those properties for the database.  I think you can set them at design time but I know you can set them at run time like was poseted above.
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10740293
SCOTT78, yoy might want to try being a liitle more hospitable with your grading.

If you didn't get the answer you wanted, hold off until you get it. ( question = 1 day old)

Experts may not answer your questions if you are gonna grade in the fashion you do.

Shane
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

834 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