0% found this document useful (0 votes)
41 views

Reg Code

This C# code defines a Registration class with methods to handle user registration. It includes a connection string to an SQL database and code to insert user form data into a registration table when the signup button is clicked, including the user's first name, last name, email, password, and confirmed password. The fields are then cleared and a success message is displayed.

Uploaded by

Ranjana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Reg Code

This C# code defines a Registration class with methods to handle user registration. It includes a connection string to an SQL database and code to insert user form data into a registration table when the signup button is clicked, including the user's first name, last name, email, password, and confirmed password. The fields are then cleared and a success message is displayed.

Uploaded by

Ranjana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 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