Modul C# Database SQL, Connection, Manipulasi Data Dan Report
This document discusses building a C# Windows Forms application that connects to a SQL Server database. It includes code to:
1. Design the database with fields like name, major, and semester.
2. Design the Windows Forms interface to match the database structure with textboxes, buttons, and a datagridview.
3. Write C# code behind the form to perform CRUD operations on the database like inserting, updating, deleting records and displaying them in the datagridview by connecting to the database and executing SQL commands.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
72 views4 pages
Modul C# Database SQL, Connection, Manipulasi Data Dan Report
This document discusses building a C# Windows Forms application that connects to a SQL Server database. It includes code to:
1. Design the database with fields like name, major, and semester.
2. Design the Windows Forms interface to match the database structure with textboxes, buttons, and a datagridview.
3. Write C# code behind the form to perform CRUD operations on the database like inserting, updating, deleting records and displaying them in the datagridview by connecting to the database and executing SQL commands.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4
Modul C#
Database SQL, Connection,manipulasi data dan Report
1. Rancanglah Database pada Sql Server dengan field seperti dibawah ini.
2. Rancanglah tampilan interface pada lingkungan windows C# .Net seperti dibawah ini sesuai dengan database yang anda buat
Listing Program 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; using System.Data.SqlClient;
namespace lat_c_shap { public partial class Form1 : Form { public SqlConnection con1; public SqlCommand com1, com2;
public SqlDataAdapter adp1; public DataSet ds1;
public Form1() { InitializeComponent(); }
private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'ds1.tbmhs' table. You can move, or remove it, as needed. this.tbmhsTableAdapter1.Fill(this.ds1.tbmhs);
string cstr; cstr = "Data Source=ZEBAOTH-779C970;Initial Catalog=pop;Integrated Security=True"; con1 = new SqlConnection(cste); con1.Open(); com1 = new SqlCommand(); com1.Connection = con1; com1.CommandType = CommandType.Text; ds1 = new DataSet(); adp1 = new SqlDataAdapter(com1); adp1.Fill(ds1, "tbmhs"); dg1.DataSource = ds1; dg1.DataMember = "tbmhs"; con1.Close();