How to find column definition - Sql Server

The DataSet in ADO.NET represents a collection of data retrieved from a data source. It provides a disconnected data model, which means it can work with the data it contains independently of the original data source. This allows for offline data manipulation and processing.

SqlDataAdapter object

The SqlDataAdapter object is used to populate a DataTable within a DataSet. It acts as a bridge between the data source and the DataSet, allowing you to retrieve data from the source and fill it into the DataTable. The Fill method of the SqlDataAdapter is used to populate the data from the data source into the DataSet.


The DataSet can contain more than one table at a time. Each table is represented by a DataTable object within the DataSet. A DataTable consists of rows and columns, where each row represents a record or data entry, and each column represents a specific attribute or field of that record. The data is organized in a tabular format, with rows and columns forming a structured representation of the data.

Full Source VB.NET
Imports System.Data.SqlClient Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim connetionString As String Dim connection As SqlConnection Dim command As SqlCommand Dim adapter As New SqlDataAdapter Dim ds As New DataSet Dim dt As DataTable Dim column As DataColumn Dim sql As String connetionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password" sql = "Your SQL Statement Here" connection = New SqlConnection(connetionString) Try connection.Open() command = New SqlCommand(sql, connection) adapter.SelectCommand = command adapter.Fill(ds, "SQL Temp Table") adapter.Dispose() command.Dispose() connection.Close() dt = ds.Tables(0) For Each column In dt.Columns MsgBox(column.ColumnName) Next Catch ex As Exception MsgBox("Can not open connection ! ") End Try End Sub End Class


DataSet provides a flexible and powerful means of working with data in a disconnected manner, allowing for efficient data retrieval, manipulation, and processing.