---
title: "Binding data with DataGridView"  
description: "Binding data with DataGridView"  
author: "John Smith"  
published: 2010-09-29  
updated: 2010-09-30  
canonical: https://www.mindstick.com/forum/4/binding-data-with-datagridview  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Binding data with DataGridView

Please let me know where I am [wrong](https://answers.mindstick.com/qa/48468/who-wrote-the-the-wrong-enemy-america-in-afghanistan-2001-2014-and-when)\
\
Here [binding](https://www.mindstick.com/blog/146/dynamic-binding-in-c-sharp) [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) with [datagridview](https://www.mindstick.com/articles/607/working-with-datagridview-in-vc-sharp) [control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) in C#\
\

```
SqlConnection con =        new SqlConnection("server=****\\sqlexpress; uid=sa; password=sa;         database=****");
                                   con.Open();                                   SqlDataAdapter ada =        new SqlDataAdapter("select * from tableName", con);                                   DataTable dt =        new DataTable();                                   ada.Fill(dt);                                   dataGridView1.DataSource = adaa;
```

\

## Replies

### Reply by John Smith

yes i missed that...thanks\

### Reply by Uttam Misra

Replace this line of code\
dataGridView1.DataSource = adaa;\
with\

```
   dataGridView1.DataSource = dt;   dt[DataTable name]
```


---

Original Source: https://www.mindstick.com/forum/4/binding-data-with-datagridview

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
