Hi Guys.  
Now go easy on me...I'm new to all this...hope I'm explaining this right....
I want my Delphi App to check for a user, if not found add that user complete with security dbRoles.
I want my Delphi App to check SQL Server Security DB for the existance of a user which I can do, however, how do i get this info back into Delphi so that I can act on it.
var NoUserExists : boolean;
Query.SQL.Clear;
Query.SQL.Add('IF SUSER_ID('''+thisuser+''') IS NULL) ;  // can't do anything else here until executed...
RoleQuery.Execute;
			
									
									
						NEWBIE - Checking for existance of a SQL user
Re: NEWBIE - Checking for existance of a SQL user
To resolve the task, you can use the following code:
			
									
									
						Code: Select all
var NoUserExists: boolean;
...
  Query.SQL.Clear;
  Query.SQL.Text('IF SUSER_ID(''' + thisuser + ''') IS NULL SELECT ''True'' ELSE SELECT ''False''') ;
  Query.Open;
  NoUserExists := Query.Fields[0].AsBoolean;
  if NoUserExists then
    RoleQuery.Execute;Re: NEWBIE - Checking for existance of a SQL user
Many thanks ViktorV.   
Wasn't expecting such a quick response....
			
									
									
						Wasn't expecting such a quick response....
Re: NEWBIE - Checking for existance of a SQL user
Thank you for your interest to our products. 
If you have any other questions, feel free to contact us.
			
									
									
						If you have any other questions, feel free to contact us.