| | |
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 ado.net algorithm alignment array barchart bitmap box broadcast buttons c# chat check checkbox client color combobox control conversion csharp custom customactiondata database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ hospitalmanagementsystems httpwebrequest image index input install java label list listbox listener mandelbrot math mouseclick mysql networking operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






