You are on page 1of 1

using System;

using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Ecom
{
public partial class Registration : System.Web.UI.Page
{
static string connString = @"Data Source=LAPTOP-TP8GSGH2\SQLEXPRESS;Initial
Catalog=Ecomapi;Integrated Security=True";
SqlConnection conn = new SqlConnection(connString);
protected void Page_Load(object sender, EventArgs e)
{

protected void btnSignUp_Click(object sender, EventArgs e)


{
conn.Open();
SqlCommand cmd = new SqlCommand("Insert Into RegForm values(@FName,
@LName, @Email, @Password, @CPassword)", conn);
cmd.Parameters.AddWithValue("@FName", txtFName.Text);
cmd.Parameters.AddWithValue("@LName", txtLName.Text);
cmd.Parameters.AddWithValue("@Email", txtEmail.Text);
cmd.Parameters.AddWithValue("@Password", txtPassword.Text);
cmd.Parameters.AddWithValue("@CPassword", txtCPassword.Text);
cmd.ExecuteNonQuery();

txtFName.Text = "";
txtLName.Text = "";
txtEmail.Text = "";
txtPassword.Text = "";
txtCPassword.Text = "";

Label1.Text = "Sign Up Successfully";


Label1.ForeColor = System.Drawing.Color.Green;
conn.Close();
}
}
}

You might also like