Discussion:
Invalid Authorization specification
(too old to reply)
shahzard
2004-05-13 08:48:14 UTC
Permalink
Hi,
When ever I close my application, I get the above mentioned error, namely "Invalid Authorization specification". Why does this error messsage appears and how can solve this problem?

If the reader is mr.Brian Bushay, Mr.Bushay:
earlier on I got an function published by you, to connect to a MS SQL Server from you, which is:

Function
TMainForm.Datbase_Connect(stUser,stPass,stServer:String;lgIntegratedSecurity:boolean):Boolean;
var
UserName, stError: String;
pcRtnError: pChar;
iErr:longInt;
stErr:String;
Begin
result := false;
With dm.dbmain do Try
Connected := false;
ConnectionString := 'Provider=SQLOLEDB.1' ;
if lgIntegratedSecurity then
begin
ConnectionString := ConnectionString
+';Integrated Security=SSPI';
end;
ConnectionString := ConnectionString
+';Persist Security Info=False'
+';Password='+stPass
+';Initial Catalog='+SQLDatabase //set database at runtime
+';Data Source='+stServer
+';Locale Identifier=1033'
+';Connect Timeout=5'
+';Use Procedure for Prepare=1'
+';Auto Translate=True'
+';Packet Size=4096';
if not Connected then Begin
Cursor := crhourGlass;
Open(stUser,stPass);
Cursor := crDefault;
end;//if
Connected:=true;
result := true;
Except
on E : EOleException do Begin
iErr := (e as EOleException).errorCode;
stErr:= (e as EOleException).message;
if (Pos(upperCase('Login failed'), upperCase(stErr)) >0) then
//invlid login
exit // other errors caught the rest of this error handler
//some other database error let the message show up
stError := 'Access to application is unavailable'
+chr(10)+chr(13)+E.Message;
Application.MessageBox(pchar(stError),'Cancel', MB_Ok) ;
exit;
end;//ON
end;//Try
end;

After implementing this function, I was getting the problem. I checked it before execution, but delphi didn't return any error messages. also wish clarify about the following portion of the function:

if (Pos(upperCase('Login failed'), upperCase(stErr)) >0) then
//invlid login
EXIT // other errors caught the rest of this error handler
//some other database error let the message show up
stError := 'Access to application is unavailable'
+chr(10)+chr(13)+E.Message;
Application.MessageBox(pchar(stError),'Cancel', MB_Ok) ;
exit;


The word "EXIT" typed in uppercase, COuld u please mention why are you using this word there

Thanx,

Shahzard
Brian Bushay TeamB
2004-05-14 02:52:27 UTC
Permalink
Post by shahzard
if (Pos(upperCase('Login failed'), upperCase(stErr)) >0) then
//invlid login
EXIT // other errors caught the rest of this error handler
//some other database error let the message show up
stError := 'Access to application is unavailable'
+chr(10)+chr(13)+E.Message;
Application.MessageBox(pchar(stError),'Cancel', MB_Ok) ;
exit;
The word "EXIT" typed in uppercase, COuld u please mention why are you using this word there
If it is a login error I don't want any additional error checking to occur.
--
Brian Bushay (TeamB)
***@NMPLS.com

Loading...