Export Data from SQL Table into text file

ryoka012

Active member
Joined
Oct 13, 2011
Messages
32
Programming Experience
Beginner
Hi,

As state in my Title how can i export it on text file
By using Datasource.
VB.NET:
DataGridView.Columns.Clear()
        Dim con As New SqlConnection(SQLConn)
 
            con.Open()
            Dim cmd As SqlCommand = con.CreateCommand
            cmd.CommandText = "Select * from Table"
            cmd.CommandType = CommandType.Text
            Dim dr As SqlDataReader = cmd.ExecuteReader
            Dim dt As New DataTable
            dt.Load(dr)
            DataGridView.DataSource = dt

Appreciate you help..
 
Back
Top