Binding data to grid view <p>Trying to bind a table to data grid. I dont see why the following code is not working. </p> <pre><code>private void Form1_Load(object sender, EventArgs e) { SqlConnection sqlConn = new SqlConnection("MyConnectionString"); string select = "SELECT CategoryId, CategoryName, Description FROM dbo.Categories"; SqlDataAdapter dataAdapter = new SqlDataAdapter(select, sqlConn); SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter); DataTable dt = new DataTable(); dt.Locale = System.Globalization.CultureInfo.InvariantCulture; dataAdapter.Fill(dt); dataGridView1.ReadOnly = true; //dataGridView1.DataSource = dt; dataGridView1.DataSource = northwindDataSetBindingSource; dataGridView1.AutoResizeColumns( DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader); } </code></pre>