dear all of you firstly i submitted my code what is used in login 3 tire architecture.
username - admin and pwd is : santosh in my database. tbluser then i send to you all code.
i run this project and submit username and password click on login button generate error:
An expression of non-boolean type specified in a context where a condition is expected, near 'santosh'.
DL Code IS :
----------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace DL
{
public class clsDLayer
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString.ToString());
public DataSet LoginToSystem(string UserName, string Passsword)
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * from tbluser where UserName='" + UserName.ToString() + "' and '" + Passsword.ToString() + "'", con);
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
if (con.State == ConnectionState.Open)
{
con.Close();
}
}
}
}
-----------------------------
BL CODE lS :
-----------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DL;
namespace BL
{
public class clsBLayer
{
public DataSet LoginToSystem(string UserName, string Password)
{
DataSet ds = obj2.LoginToSystem(UserName,Password);
return ds;
}
}
}
-------------------------
Login.aspx.cs Code Is:
-------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BL;
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
clsBLayer c2 = new clsBLayer();
DataSet ds = new DataSet();
ds = c2.LoginToSystem(txtUserName.Text,txtPwd.Text);
if (ds.Tables[0].Rows.Count != 0)
{
Session["UserName"] = ds.Tables[0].Rows[0][1].ToString();
Response.Redirect("~/Admin/AdminDashboard.aspx");
}
else
{
Response.Write("Sorry! Incorrect Username and Password.");
}
}
protected void btnClear_Click(object sender, EventArgs e)
{
clear();
}
protected void clear() {
txtUserName.Text = "";
txtPwd.Text = "";
}
}
thank your in advance all of you..