User, Password Verification: Body Form Div Asp Textbox Asp Textbox Asp Label
User, Password Verification: Body Form Div Asp Textbox Asp Textbox Asp Label
<body>
<form id="form1" runat="server">
<div>
</div>
<p>
<asp:Label ID="lblPassword" style="position:absolute;
top: 64px; left: 59px;"
runat="server" Text="Password" Font-Bold="True" Font-
Italic="True"
Font-Size="Large" ForeColor="#FF3399"></asp:Label>
</p>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
con = new SqlConnection("Data Source=COMPUTER-
A7D401\\SQLEXPRESS;Initial Catalog=vinod;Integrated
Security=True");
con.Open();
cmd = new SqlCommand("select * from AdminUser where
UserName=@UserName and Password=@Password",con);
//cmd.Parameters.Add("@UserName",
SqlDbType.VarChar).Value = txtUserName.Text;
//cmd.Parameters.Add("@Password",
SqlDbType.VarChar).Value = txtPassword.Text;
cmd.Parameters.Add("@UserName", txtUserName.Text);
cmd.Parameters.Add("@Password", txtPassword.Text);
SqlDataReader rec;
rec = cmd.ExecuteReader();
rec.Read();
if (rec.HasRows)
{
Label1.Text = "successfully";
}
else
{
Label1.Text = "User not found";
}
}
}
Data Base