Re: A little help on a proc

From: Keith Kratochvil (sqlguy.back2u_at_comcast.net)
Date: 02/07/05


Date: Mon, 7 Feb 2005 08:48:25 -0600

You can do anything you want. Do you care if the loginname is invalid? Do
you care if the password is invalid? Or do you just want a "Yes,
authentication passed -- here is your data" or an "Authentication Failed"
notification?

-- 
Keith
"David Lozzi" <dlozzi@(remove-this)delphi-ts.com> wrote in message
news:e8kNiGSDFHA.560@TK2MSFTNGP15.phx.gbl...
> So the best process is to rerun the query? Wouldnt that get extensive for
> the server? Can I run something like this:
>
> create proc users
> @Fullname VARCHAR Output, @Security Integer OUTPUT, etc.
>
> Run query that verifies username
> if username valid
>     check password against previously returned recordset
>     if password valid
>         @fullname = returned data, @security, etc.
>     else
>         return 2
> else
>     return 1
> end
>
>
> By the way, i'm accessing this from an ASP.NET page.
>
> -- 
> David Lozzi
> Web Applications/Network Specialist
> Delphi Technology Solutions, Inc.
> dlozzi(remove-this)@delphi-ts.com
>
>
> "Keith Kratochvil" <sqlguy.back2u@comcast.net> wrote in message
> news:eMvhnASDFHA.2632@TK2MSFTNGP12.phx.gbl...
> > This should get you started:
> >
> > create proc foo as
> > @loginname varchar(20),
> > @password varchar(50)
> > as
> >
> > --verify that the login is valid
> > if not exists (select * from sometable where somelogincolumn =
@loginname)
> > BEGIN
> >  RETURN (1)
> > END
> >
> > --verify that the password is valid
> > if not exists (select * from sometable where somelogincolumn =
@loginname
> > AND somepasswordcolumn = @password)
> > BEGIN
> >  RETURN (2)
> > END
> >
> > select somecolumn
> > from sometable
> > where somelogincolumn = @loginnamae
> > and somepasswordcolumn = @password
> > RETURN (0)
> > GO
> >
> > The return code will be 1 if the login does not exist, 2 if the password
> > is
> > not correct.  If the login exists and the password is correct the third
> > statement will be executed and the return code will be set to 0.
> >
> > -- 
> > Keith
> >
> >
> > "David Lozzi" <dlozzi@(remove-this)delphi-ts.com> wrote in message
> > news:eShjWtRDFHA.512@TK2MSFTNGP15.phx.gbl...
> > I'm fairly new to the stored procedure world, I can create one to return
a
> > record set, look at me go. However, I need to get a little more
advanced.
> > I
> > need to do the following in a proc:
> >
> > Query a honken huge query and check if login is valid. If so, continue
> > through proc and return the necessary data, if not return an invalid
> > status.
> >
> > Thanks a million!!
> >
> >
> > -- 
> > David Lozzi
> > Web Applications/Network Specialist
> > Delphi Technology Solutions, Inc.
> > dlozzi(remove-this)@delphi-ts.com
> >
> >
>
>


Relevant Pages

  • Invalid Argument Error
    ... I'm not sure that I'm in the correct group. ... This morning I tried to execute my query. ... I modified my query and I when I went to save it, I got the "Invalid Argument" ... When I tried to compact and repair my db, I got the "Invalid Argument" error. ...
    (microsoft.public.access.setupconfig)
  • Re: How do I temporarily limit values in a query field
    ... I am getting an error message: "The expression you entered has a invalid ..or! ... This is the last few lines of the 'old' sql with an attempt to limit the records to values of <500: ... works fine until I try to put limits on it value in the qryClaimDetails query. ...
    (microsoft.public.access.queries)
  • Re: Table and PHP scripts for existing data
    ... >2) once the table is created inside my database on MySQL, ... >load the data in? ... DELETE query"); ... ("Invalid DATA LOAD query"); ...
    (comp.lang.php)
  • Re: Invalid Arguement Error
    ... I'm trying to run a simple select query, and when I try to save the ... I get the error "Invalid Arguement." ... [2006 Voter File].PartyAffiliationDate, [2006 Voter ... dbInconsistent in the options argument to the OpenRecordset method. ...
    (microsoft.public.access.queries)
  • Re: Tcl C extn - Scoping in extended cmds - how to?
    ... so that the above code becomes invalid and the ... following (pure Tcl way) should only be allowed. ... Here's my guess at proc semantics stolen from old code of mine. ...
    (comp.lang.tcl)