Article View: borland.public.cppbuilder.database.ado
Article #768Re: Using a Login prompt to connect to a database
From: James Peterson
Date: Fri, 08 Apr 2005 15:24
Date: Fri, 08 Apr 2005 15:24
57 lines
2697 bytes
2697 bytes
on your ADOConnection1 or what ever you call it there is a value called
LoginPrompt.
ADOConnection1->LoginPrompt = True.
Based on your ODBC this is the simplest way to do a login prompt the way you
want it.
You can also track your logins .. for example using ADOConnect you can set
up a Class veriable some where that tracks the number of times attempted.
class TForm1 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
int attempt;
};
file://---------------------------------------------------------------------
------
extern PACKAGE TForm1 *Form1;
file://---------------------------------------------------------------------
------
#endif
_fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
attempt =0;
}
void __fastcall TForm1::ADOConnection1ConnectComplete(
TADOConnection *Connection, const Error *Error,
TEventStatus &EventStatus)
{
...
attempt++;
if(attempt == 3)
Application->Terminate();
...
}
"Nigel" <nhussey@gltame.com> wrote in message
news:4231643b@newsgroups.borland.com...
> Hello everyone,
> I have just reciently ported an application using a MSAccess Database to
SQL
> Server, and now want to use the login prompt for users to login.
Everything
> works fine, but I want to be able to capture an incorrect login and
> redisplay the login prompt until the login is correct or terminate the
> applciation if the user clicks the cancel button on the login prompt.
>
> Any help with this will be greatly appreciated
> Nigel
>
> P.S. I cannot get the sample given in the help system of BCB6 to work,
maybe
> something to do with encoded usernames and passwords that I am not using.
>
>
Technical Details
Message-ID:
<4256a21b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4231643b@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,49235dc1c8772707 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit From: "James Peterson" <jpeterson@romanmealmilling.com> Newsgroups: borland.public.cppbuilder.database.ado References: <4231643b@newsgroups.borland.com> Subject: Re: Using a Login prompt to connect to a database Date: Fri, 8 Apr 2005 10:24:12 -0500 Lines: 59 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 64.21.236.129 Message-ID: <4256a21b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1112973851 64.21.236.129 (8 Apr 2005 08:24:11 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail