Solved

Database

Posted on 2004-03-31
6
173 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
[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
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 60 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
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 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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

688 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