Solved

Database

Posted on 2004-03-31
6
167 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 11

Expert Comment

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

Calinutz
0
 

Expert Comment

by:meadorj
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now