PC Review


Reply
Thread Tools Rate Thread

How to control a login?

 
 
=?Utf-8?B?UnVkeQ==?=
Guest
Posts: n/a
 
      7th Feb 2005
Hello all!

I'm working on a windows app, using SQL for my databse. I have a table
named "user id". There are 50 user numbers, ranging from 1-50. The numbers
are actually the login. no password. I would like to have a user sit down at
a computer, hit a button and go. I need the computer to be logged in from
the list of 50 number. If number 34 is taken for example, it continues to
look for a free number, until it finds one, then logs in.

Any ideas on what is the best way to approach this?

Thanks!!

Rudy
 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      7th Feb 2005
That is this number is just used to track the user the time of its session ?
Any reason for not using the usual session mechanism ?

Patrice


--

"Rudy" <(E-Mail Removed)> a écrit dans le message de
news1500281-BF88-4EE4-A388-(E-Mail Removed)...
> Hello all!
>
> I'm working on a windows app, using SQL for my databse. I have a table
> named "user id". There are 50 user numbers, ranging from 1-50. The

numbers
> are actually the login. no password. I would like to have a user sit down

at
> a computer, hit a button and go. I need the computer to be logged in from
> the list of 50 number. If number 34 is taken for example, it continues to
> look for a free number, until it finds one, then logs in.
>
> Any ideas on what is the best way to approach this?
>
> Thanks!!
>
> Rudy



 
Reply With Quote
 
Alex
Guest
Posts: n/a
 
      7th Feb 2005
Hi Rudy,
I am not sure about this, but since you are using a windows app you
might not be connected to your SQL Server over the whole application
life cycle. I would simply add a new column to your users table called
*locked* or whatever. As soon as a client connects to your DB you get
the highest ID which is not locked.
Like
Select Max(userID) from users where locked = false
You apply this ID to the client.

Now, you have to make sure that when the client closed the app he frees
the ID for other users.

You can catch the close event of the main form and set the locked state
of the user ID back to false.

Maybe you have to add additional mechanisms to ensure that users are
unlocked when the app crashes...

Kind regards
Alex



http://www.flashshop.info

Rudy wrote:
> Hello all!
>
> I'm working on a windows app, using SQL for my databse. I have a table
> named "user id". There are 50 user numbers, ranging from 1-50. The numbers
> are actually the login. no password. I would like to have a user sit down at
> a computer, hit a button and go. I need the computer to be logged in from
> the list of 50 number. If number 34 is taken for example, it continues to
> look for a free number, until it finds one, then logs in.
>
> Any ideas on what is the best way to approach this?
>
> Thanks!!
>
> Rudy

 
Reply With Quote
 
=?Utf-8?B?UnVkeQ==?=
Guest
Posts: n/a
 
      7th Feb 2005
Hi Patrice and Alex!

Great suggestions! Alex, I was kind of thinking of doing waht you said, but
you have a better approach. I also thought about just creating a view for
each session. and deleting the view when user log out.

Patrice, I never heard of the session mechanism, of course I am new at this.
I'll look into it.

Thanks for the advice!!!!

Rudy


"Alex" wrote:

> Hi Rudy,
> I am not sure about this, but since you are using a windows app you
> might not be connected to your SQL Server over the whole application
> life cycle. I would simply add a new column to your users table called
> *locked* or whatever. As soon as a client connects to your DB you get
> the highest ID which is not locked.
> Like
> Select Max(userID) from users where locked = false
> You apply this ID to the client.
>
> Now, you have to make sure that when the client closed the app he frees
> the ID for other users.
>
> You can catch the close event of the main form and set the locked state
> of the user ID back to false.
>
> Maybe you have to add additional mechanisms to ensure that users are
> unlocked when the app crashes...
>
> Kind regards
> Alex
>
>
>
> http://www.flashshop.info
>
> Rudy wrote:
> > Hello all!
> >
> > I'm working on a windows app, using SQL for my databse. I have a table
> > named "user id". There are 50 user numbers, ranging from 1-50. The numbers
> > are actually the login. no password. I would like to have a user sit down at
> > a computer, hit a button and go. I need the computer to be logged in from
> > the list of 50 number. If number 34 is taken for example, it continues to
> > look for a free number, until it finds one, then logs in.
> >
> > Any ideas on what is the best way to approach this?
> >
> > Thanks!!
> >
> > Rudy

>

 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      7th Feb 2005
Just disregard my previous message. It doesn't apply to Windows application
and I wrongly thought it was a web group or something else short circuited
in my brain...

Sorry for the useless post...

Patrice



--

"Rudy" <(E-Mail Removed)> a écrit dans le message de
news:B1FC083E-A512-4087-A117-(E-Mail Removed)...
> Hi Patrice and Alex!
>
> Great suggestions! Alex, I was kind of thinking of doing waht you said,

but
> you have a better approach. I also thought about just creating a view for
> each session. and deleting the view when user log out.
>
> Patrice, I never heard of the session mechanism, of course I am new at

this.
> I'll look into it.
>
> Thanks for the advice!!!!
>
> Rudy
>
>
> "Alex" wrote:
>
> > Hi Rudy,
> > I am not sure about this, but since you are using a windows app you
> > might not be connected to your SQL Server over the whole application
> > life cycle. I would simply add a new column to your users table called
> > *locked* or whatever. As soon as a client connects to your DB you get
> > the highest ID which is not locked.
> > Like
> > Select Max(userID) from users where locked = false
> > You apply this ID to the client.
> >
> > Now, you have to make sure that when the client closed the app he frees
> > the ID for other users.
> >
> > You can catch the close event of the main form and set the locked state
> > of the user ID back to false.
> >
> > Maybe you have to add additional mechanisms to ensure that users are
> > unlocked when the app crashes...
> >
> > Kind regards
> > Alex
> >
> >
> >
> > http://www.flashshop.info
> >
> > Rudy wrote:
> > > Hello all!
> > >
> > > I'm working on a windows app, using SQL for my databse. I have a

table
> > > named "user id". There are 50 user numbers, ranging from 1-50. The

numbers
> > > are actually the login. no password. I would like to have a user sit

down at
> > > a computer, hit a button and go. I need the computer to be logged in

from
> > > the list of 50 number. If number 34 is taken for example, it continues

to
> > > look for a free number, until it finds one, then logs in.
> > >
> > > Any ideas on what is the best way to approach this?
> > >
> > > Thanks!!
> > >
> > > Rudy

> >



 
Reply With Quote
 
=?Utf-8?B?UnVkeQ==?=
Guest
Posts: n/a
 
      8th Feb 2005
Hi Alex,
Thanks again for your idea! I put it to work, and I think I almost got it,
just a little bump. Here is the store proc that I have.
CREATE PROCEDURE [dbo].[max tableid] AS
SELECT MAX(TableID) AS Expr1
FROM TableID
WHERE (Inuse =0)
GO
My table"tableID", has a tableid col, and a Inuse col. my tableID is set
from 1- 5. my inuse is a bit, 1 or 0. 1 the table is in use, 0 the table is
free.
Here is a snippet of my code.
cmdLog = New SqlCommand("Max TableID", conLog)
cmdLog.CommandType = CommandType.StoredProcedure
TableIDReturn = cmdLog.Parameters.Add("ReturnValue", SqlDbType.Int)
TableIDReturn.Direction = ParameterDirection.ReturnValue

conLog.Open()
cmdLog.ExecuteNonQuery()

intTableID = cmdLog.Parameters("ReturnValue").Value
If intTableID <= 5 Then
myMainfrm.Show()
Else : intTableID = 0
MessageBox.Show("Sorry")
conLog.Close()
End If
My question is how can I have my "if"command select only from 1 to 5, and if
nothing shows up in the col, if all the tables were in use, that value = 0.

Thanks again for your help!

"Alex" wrote:

> Hi Rudy,
> I am not sure about this, but since you are using a windows app you
> might not be connected to your SQL Server over the whole application
> life cycle. I would simply add a new column to your users table called
> *locked* or whatever. As soon as a client connects to your DB you get
> the highest ID which is not locked.
> Like
> Select Max(userID) from users where locked = false
> You apply this ID to the client.
>
> Now, you have to make sure that when the client closed the app he frees
> the ID for other users.
>
> You can catch the close event of the main form and set the locked state
> of the user ID back to false.
>
> Maybe you have to add additional mechanisms to ensure that users are
> unlocked when the app crashes...
>
> Kind regards
> Alex
>
>
>
> http://www.flashshop.info
>
> Rudy wrote:
> > Hello all!
> >
> > I'm working on a windows app, using SQL for my databse. I have a table
> > named "user id". There are 50 user numbers, ranging from 1-50. The numbers
> > are actually the login. no password. I would like to have a user sit down at
> > a computer, hit a button and go. I need the computer to be logged in from
> > the list of 50 number. If number 34 is taken for example, it continues to
> > look for a free number, until it finds one, then logs in.
> >
> > Any ideas on what is the best way to approach this?
> >
> > Thanks!!
> >
> > Rudy

>

 
Reply With Quote
 
Alex
Guest
Posts: n/a
 
      8th Feb 2005
Hi Rudy,

the proc returns DBNull if no record found.
So you can do:

if cmdLog.Parameters("ReturnValue").Value = System.DBNull.Value Then
'no go

Best regards
Alex

- Alexander Rauser

http://www.flashshop.info

Rudy wrote:
> Hi Alex,
> Thanks again for your idea! I put it to work, and I think I almost got it,
> just a little bump. Here is the store proc that I have.
> CREATE PROCEDURE [dbo].[max tableid] AS
> SELECT MAX(TableID) AS Expr1
> FROM TableID
> WHERE (Inuse =0)
> GO
> My table"tableID", has a tableid col, and a Inuse col. my tableID is set
> from 1- 5. my inuse is a bit, 1 or 0. 1 the table is in use, 0 the table is
> free.
> Here is a snippet of my code.
> cmdLog = New SqlCommand("Max TableID", conLog)
> cmdLog.CommandType = CommandType.StoredProcedure
> TableIDReturn = cmdLog.Parameters.Add("ReturnValue", SqlDbType.Int)
> TableIDReturn.Direction = ParameterDirection.ReturnValue
>
> conLog.Open()
> cmdLog.ExecuteNonQuery()
>
> intTableID = cmdLog.Parameters("ReturnValue").Value
> If intTableID <= 5 Then
> myMainfrm.Show()
> Else : intTableID = 0
> MessageBox.Show("Sorry")
> conLog.Close()
> End If
> My question is how can I have my "if"command select only from 1 to 5, and if
> nothing shows up in the col, if all the tables were in use, that value = 0.
>
> Thanks again for your help!
>
> "Alex" wrote:
>
>
>>Hi Rudy,
>>I am not sure about this, but since you are using a windows app you
>>might not be connected to your SQL Server over the whole application
>>life cycle. I would simply add a new column to your users table called
>>*locked* or whatever. As soon as a client connects to your DB you get
>>the highest ID which is not locked.
>>Like
>>Select Max(userID) from users where locked = false
>>You apply this ID to the client.
>>
>>Now, you have to make sure that when the client closed the app he frees
>>the ID for other users.
>>
>>You can catch the close event of the main form and set the locked state
>>of the user ID back to false.
>>
>>Maybe you have to add additional mechanisms to ensure that users are
>>unlocked when the app crashes...
>>
>>Kind regards
>>Alex
>>
>>
>>
>>http://www.flashshop.info
>>
>>Rudy wrote:
>>
>>>Hello all!
>>>
>>>I'm working on a windows app, using SQL for my databse. I have a table
>>>named "user id". There are 50 user numbers, ranging from 1-50. The numbers
>>>are actually the login. no password. I would like to have a user sit down at
>>>a computer, hit a button and go. I need the computer to be logged in from
>>>the list of 50 number. If number 34 is taken for example, it continues to
>>>look for a free number, until it finds one, then logs in.
>>>
>>>Any ideas on what is the best way to approach this?
>>>
>>>Thanks!!
>>>
>>>Rudy

>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't create simple login page using asp:login control Sasquatch Microsoft ASP .NET 2 3rd Oct 2006 10:22 PM
cannot login with Login control ad Microsoft C# .NET 2 11th Jul 2006 01:12 AM
PasswordRecovery control trips Login control's validation The Colonel Microsoft ASP .NET 1 6th Jul 2006 10:18 PM
Login control with RadioBox control =?Utf-8?B?d2Vp?= Microsoft ASP .NET 0 28th Feb 2006 10:51 PM
How to center login button in Login control? ike2010 Microsoft ASP .NET 0 15th Nov 2005 09:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:22 PM.