using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.Sql; using System.Data.SqlClient; namespace LectDB1Custom { public partial class Form1 : Form { DataSet dataSet; SqlDataAdapter adapter; SqlConnection conn; SqlCommand selectCommand; public Form1() { InitializeComponent(); ShowData(); } private void ShowData() { dataSet = new DataSet(); adapter = new SqlDataAdapter(); conn = new SqlConnection(@"Data Source=MACHINENAMEGOESHERE\SQLEXPRESS;Initial Catalog=TestSQL2;IntegratedSecurity=True"); selectCommand = new SqlCommand("SELECT * FROM Lecturers", conn); adapter.SelectCommand = selectCommand; adapter.Fill(dataSet,"Lect"); dataGridView1.DataSource = dataSet.Tables["Lect"]; } } }