0% found this document useful (0 votes)
197 views3 pages

Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

The document contains C# code for a Windows Forms application that connects to a SQL database. It defines methods for opening a SQL connection, inserting, updating, deleting and selecting student records from a database table using SQL commands. The methods handle parameters and execute queries to manipulate data in response to button clicks. A separate form is launched to display selected records.

Uploaded by

Sachin Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
197 views3 pages

Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

The document contains C# code for a Windows Forms application that connects to a SQL database. It defines methods for opening a SQL connection, inserting, updating, deleting and selecting student records from a database table using SQL commands. The methods handle parameters and execute queries to manipulate data in response to button clicks. A separate form is launched to display selected records.

Uploaded by

Sachin Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

using System;

using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];

namespace WindowsApplication12
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void toolStripMenuItem1_Click(object sender, EventArgs


e)
{
SqlConnection con = new SqlConnection();
[Link] = "Data Source=.; Initial Catalog
=seercadd; Integrated Security=true";
[Link]();
}

private void button1_Click(object sender, EventArgs e)


{
SqlCommand cmd = new SqlCommand();
[Link] = "insert into seercadd
values(@STUDENT_NAME,@REGISTRATION_NO,@FATHER_NAME,@DATE_OF_BIRTH,@MOBIL
E,@COURSE,@DURATION)";
[Link]("@STUDENT_NAME", [Link],
50).Value = Convert.ToInt32([Link]);
[Link]("@REGISTRATION_NO", [Link],
50).Value = [Link];
[Link]("@FATHER_NAME", [Link],
50).Value = [Link];
[Link]("@DATE_OF_BIRTH", [Link],
50).Value = Convert.ToInt32([Link]);
[Link]("@MOBILE", [Link], 50).Value =
Convert.ToInt32([Link]);
[Link]("@COURSE", [Link], 50).Value =
Convert.ToInt32([Link]);
[Link]("@DURATION", [Link], 50).Value
= Convert.ToInt32([Link]);
[Link]();
[Link]();
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link]();
}

private void button2_Click(object sender, EventArgs e)


{
SqlCommand cmd = new SqlCommand();
[Link] = "select * from SEERCADD where
REGISTRATION_NO=@REGISTRATION_NO";
[Link]("@REGISTRATION_NO", [Link]).Value =
Convert.ToInt32([Link]);
SqlDataReader dr;
dr = [Link]();
if ([Link])
{
[Link]();
[Link] = dr["STUDENT_NAME"].ToString();
[Link] = dr["REGISTRATION_NO"].ToString();
[Link] = dr["FATHER_NAME"].ToString();
[Link] = dr["DATE_OF_BIRTH"].ToString();
[Link] = dr["MOBILE"].ToString();
[Link] = dr["COURSE"].ToString();
[Link] = dr["DURATION"].ToString();
}

[Link]();
[Link]();
}

private void button3_Click(object sender, EventArgs e)


{

SqlCommand cmd = new SqlCommand();


[Link] = "delete from SEERCADD where
REGISTRATION_NO=@REGISTRATION_NO";
[Link]("@REGISTRATION_NO", [Link]).Value
= Convert.ToInt32([Link]);
[Link]();
[Link]();
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link]();
}

private void button4_Click(object sender, EventArgs e)


{
SqlCommand cmd = new SqlCommand();
[Link] = "update SEERCADD set
@STUDENT_NAME,@REGISTRATION_NO,@FATHER_NAME,@DATE_OF_BIRTH,@MOBILE,@COUR
SE,@DURATION";
[Link]("@STUDENT_NAME", [Link],
50).Value = Convert.ToInt32([Link]);
[Link]("@REGISTRATION_NO", [Link],
50).Value = [Link];
[Link]("@FATHER_NAME", [Link],
50).Value = [Link];
[Link]("@DATE_OF_BIRTH", [Link],
50).Value = Convert.ToInt32([Link]);
[Link]("@MOBILE", [Link], 50).Value =
Convert.ToInt32([Link]);
[Link]("@COURSE", [Link], 50).Value =
Convert.ToInt32([Link]);
[Link]("@DURATION", [Link], 50).Value
= Convert.ToInt32([Link]);
[Link]();
[Link]();
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link]();
}

private void showRecordToolStripMenuItem_Click(object sender,


EventArgs e)
{
Form3 fd = new Form3();
[Link]();
}
}
}

You might also like