-
Notifications
You must be signed in to change notification settings - Fork 1
/
Retailerlogin.aspx.cs
40 lines (38 loc) · 1.43 KB
/
Retailerlogin.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class Retailerlogin : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["mycon"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from retailerreg where retid='" + TextBox1.Text + "' and pass='" + TextBox2.Text + "' ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
Session["retid"] = dt.Rows[0]["retid"].ToString();
Session["retname"] = dt.Rows[0]["retname"].ToString();
ClientScript.RegisterStartupScript(Page.GetType(), "Validation", "<script language='javascript'>alert('Login Successfully..');window.location='Distributerpage.aspx';</script>");
}
else
{
Response.Write("<script>alert ('Invalid Id and Password')</script>");
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("Retailerregister.aspx");
}
}