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

Coding of Database

This document contains C# code for a Windows Forms application that loads and displays student data from a database. It includes code to: 1) Load student data from the "yASSERDatabase1DataSet.student" table into the form on load. 2) Navigate between student records using next and previous buttons. 3) Filter the displayed records based on the ID entered in a text box. 4) Add a new student record by clicking a button and entering values in the data grid.

Uploaded by

Muhammad Adrees
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)
38 views2 pages

Coding of Database

This document contains C# code for a Windows Forms application that loads and displays student data from a database. It includes code to: 1) Load student data from the "yASSERDatabase1DataSet.student" table into the form on load. 2) Navigate between student records using next and previous buttons. 3) Filter the displayed records based on the ID entered in a text box. 4) Add a new student record by clicking a button and entering values in the data grid.

Uploaded by

Muhammad Adrees
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
You are on page 1/ 2

\using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.

Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'yASSERDatabase1DataSet.student' table. You can move, or remove it, as needed. this.studentTableAdapter.Fill(this.yASSERDatabase1DataSet.student); //this.studentTableAdapter1.Fill(this.dataSet1.Tables,33); this.studentTableAdapter1.Fill(this.dataSet1.student, 22); textBox2.Text = ""; } private void button1_Click(object sender, EventArgs e) { this.studentBindingSource.MoveNext(); } private void button2_Click(object sender, EventArgs e) { this.studentBindingSource.MovePrevious(); } private void button3_Click(object sender, EventArgs e) { string x = textBox1.Text; //int p = Convert.ToInt32(x) ; if (x == "") { textBox1.Text = ("Please Enter some Value"); return; } this.studentTableAdapter1.Fill(this.dataSet1.student,Int32.Parse( textBox1.Text) ); } private void button4_Click(object sender, EventArgs e) { this.studentBindingSource.MoveLast(); this.studentBindingSource.AddNew(); }

private void button5_Click(object sender, EventArgs e) { //this.studentBindingSource.Add(Int32.Parse(textBox2.Text)); //this.dataSet1.AcceptChanges(); //this.studentBindingSource.EndEdit(); dataGridView1.Update(); dataGridView1.RefreshEdit(); dataGridView1.EndEdit(); } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { } } }

You might also like