| | |
hi
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2009
Posts: 13
Reputation:
Solved Threads: 0
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!!";
}
}
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!!";
}
}
![]() |
Other Threads in the C# Forum
- Previous Thread: debugging help
- Next Thread: C# datagrid question
| Thread Tools | Search this Thread |
.net access algorithm alignment app array barchart bitmap box broadcast buttons c# c#gridviewcolumn check checkbox client combobox communication control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing elevated encryption enum event excel file focus form format forms function gdi+ hospitalmanagementsystem httpwebrequest image index input install java label list listbox localization login mandelbrot math messagebox mouseclick mysql operator path photoshop picturebox pixelinversion plotting pointer post programming radians read regex remote remoting richtextbox server sleep socket sql statistics stream string stringformatting sun table text textbox thread time timer update usercontrol validation visualstudio webbrowser whileloop windows winforms wpf xml






