creating Login Page in C#

code for creating Login Page in C# with sqlserver 2005

Page 1 of 1

1 Replies - 4580 Views - Last Post: 19 June 2010 - 06:09 AM Rate Topic: -----

Poll: code for creating Login Page in C# with sqlserver 2005 (0 member(s) have cast votes)

code for creating Login Page in C# with sqlserver 2005

  1. code for creating Login Page in C# with sqlserver 2005 (0 votes [0.00%])

    Percentage of vote: 0.00%

Vote

#1 rajmarri   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-June 10

creating Login Page in C#

Posted 19 June 2010 - 06:01 AM

I am new to c#,Please tell me code for creating the Login page using c# with sqlserver 2005

MOD EDIT: Closed topic; user failed to follow the rules. If you have code with which you need help, please post it in a new thread, along with the questions you have or error you are receiving. Please note our rules.
[rules][/rules]

This post has been edited by JackOfAllTrades: 19 June 2010 - 06:32 AM

Is This A Good Question/Topic? 0
  • +

Replies To: creating Login Page in C#

#2 Sergio Tapia   User is offline

  • D.I.C Lover
  • member icon

Reputation: 1258
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: creating Login Page in C#

Posted 19 June 2010 - 06:09 AM

Welcome to DIC, we won't give out code for you here unless you show some effort.

Basically what you want is this

if(ValidateUser(username.Text, password.Text)
{
    //Show main form.
}
else
{
    //Show error MessageBox.
}


public bool ValidateUser(string username, string password)
{
    //Your query would be like:
    String.Format("Select username, password from Users where username = '{0}' and password = '{1}'", username, password);

    //This would return a record if things are ok. 
    //Now just check if the query returns a result, if it does, return a True.
}



Things that are horrible with this approach:

1. No exception handling.
2. It's assuming your passwords are plain text. Don't do that! Instead use a Hashing function to turn 'password' into 'iasdfouh1(&#(12988asidjasd' for security purposes.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1