- Open visual studio
- Drag a panel to web form for login box.
- Now drag some Textboxes ,Labels and
Buttons on web form
<asp:Panel ID="Panel1" runat="server"BackColor="Lime"BackImageUrl="~/App_Data/img1.JPG"BorderColor=
"#00CC00"Height="224px"Style="margin-left: 287px"Width="488px"> <br /> <br /> <asp:LabelID="Label2"
runat="server"Text="Username"></asp:Label> <asp:TextBox ID="TextBox1" runat="server"Height="22px"OnTextChanged="TextBox1_TextChanged1"Width="229px"
AutoCompleteType="Disabled"></asp:TextBox><br/><br/>
<asp:LabelID=
"Label3"runat="server"Text="Password"></asp:Label> <asp:TextBoxID=
"TextBox2"runat="server"Width="226px"
TextMode="Password"></asp:TextBox> <br/>  
; <br />
Email id <asp:TextBoxID="TextBox3"runat="server"
Width="223px"AutoCompleteType ="Disabled"></asp:TextBox><br /> <br />
<asp:ButtonID="Button1"runat="server"OnClick="Button1_Click"Text="Sign In" /><br/> - Now create database Using sqlserver.
- Create connection for database
public partial class _Default : System.Web.UI.Page
{
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
string str;
protected void Page_Load(object sender, EventArgs e)
{
con =new SqlConnection("Data source =MCNDESKTOP06 ;Initial Catalog=empinfo;UserID=sa;Password = wintellect");
con.Open();
}
6. Insert the data into the database which you are created
7. Now write the code on button click event
protected void Button1_Click(object sender, EventArgs e)
{
str = "select * from login info where name ='" + TextBox1.Text + "' and Password ='" + TextBox2.Text + "' and emailid ='" + TextBox3.Text + "'";
cmd = new SqlCommand(str, con);
dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["name"] = dr.GetString(0);
Response.Redirect("account.aspx");
}
else
{
Label4.Text = "Invalid user";
}
}
Output of the application

After clicking button Sign In

anupamPosted Jan 25, 2012, 1:06 AM
how can do this code in oracle
mohan kumarPosted Nov 21, 2011, 3:01 AM
Nice article
Guest UserPosted Jul 20, 2010, 8:50 AM
What?!? Do you know what Sql Injection is? Bad... Very bad...