DataGridView data binding (ADO.NET 2.0)
Posted on 2006-06-12
I would like to use the results of a stored procedure to fill a datagridview. I am not using the Data Set IDE and created the Stored Procedure objects manually. I added a blank datagridview control to the form named dgPartInfo but don't know where to go from here:
Dim cmdGetPartInfo As New SqlCommand("SW_GET_PART_BASICS", dbConn) ' gets header info from part table
cmdGetPartInfo.CommandType = CommandType.StoredProcedure
Dim PartReader As SqlDataReader = cmdGetPartInfo.ExecuteReader
dgPartInfo.DataSource = PartReader
I am moving from mostly VB6 experience to .NET 2.0 so am not very familiar with the datagrid and datagrid view controls or the difference between them. All the documantation I can find only shows how to poulate a grid by dragging items from the Data Set IDE.