943,544 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 384
  • C# RSS
Apr 30th, 2009
0

hi

Expand Post »
i m new in asp.net with c# .I am trying to make a C# application login on my ASP.NET page.I want the code for log In.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sadiyarani is offline Offline
1 posts
since Apr 2009
Apr 30th, 2009
0

Re: hi

hi..well first you need to create a table in database to be able to maintain the users who can log in...
in your application connect to the database and try the following code at your Login button..

OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDb.4.0; Data Source=F:\\QMGT.mdb;");
OleDbCommand com = new OleDbCommand("select UserId,Password From Users", con);
OleDbDataReader rd;
con.Open();
rd = com.ExecuteReader();
if (rd.HasRows)
{
while (rd.Read())
{

string s1 = rd[0].ToString();
string s2 = rd[1].ToString();
if (s1 == txtUserID.Text && s2 == txtPassword.Text)
{
Response.Redirect("Default2.aspx");
}
else
{
Label1.Text = "UserID,Password does not match Please Try again!!";
}
}
Reputation Points: 11
Solved Threads: 0
Newbie Poster
Poojasrivastava is offline Offline
13 posts
since Apr 2009
May 1st, 2009
0

Re: hi

Click to Expand / Collapse  Quote originally posted by sadiyarani ...
i m new in asp.net with c# .I am trying to make a C# application login on my ASP.NET page.I want the code for log In.
you dont even need code for login. on the tool box you have createuserwizard and the others. use them instead.
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: debugging help
Next Thread in C# Forum Timeline: C# datagrid question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC