0% found this document useful (0 votes)
22 views2 pages

PART B5 Steps

Uploaded by

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

PART B5 Steps

Uploaded by

shamaatmika.uv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PART B:

5. Create a Web Form for Login Module which adds a Username and Password to the database. The
username in the database should be a primary key.

Goto Microsoft sqlserver 2005  Create data base (2bca)create table  (login)

Design :

Click on ok

Design the below format


Code:

Add Namespace

using System.Data.SqlClient;

protected void Button1_Click(object sender, EventArgs e)

SqlConnection con = new SqlConnection("Data Source=DESKTOP-OL69NEO;Initial


Catalog=2bca;Integrated Security=True");

con.Open();

SqlCommand cmd = new SqlCommand();

cmd.Connection = con;

cmd.CommandText = "insert into login values(@uname,@password)";

cmd.Parameters.Add("@uname", SqlDbType.VarChar).Value = TextBox1.Text;

cmd.Parameters.Add("@password", SqlDbType.VarChar).Value =TextBox2.Text;

cmd.ExecuteNonQuery();

Label1.Text = "data saved";

TextBox1.Text = "";

TextBox2.Text = "";

You might also like