export Table to text

Use DataSet.WriteXml("filename.xml") method, you have to add the table to a DataSet first since DataTable.WriteXml method was not included until .Net 2.0.
 
Hi john

I got two problem :

this the code :

VB.NET:
Imports System.Data.OleDb
Imports System.IO

    Dim cn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim dr As OleDbDataReader
    Dim w As StreamWriter

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            w = File.AppendText("c:\1test1.txt")
            cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\1\tt.mdb;")
            
            cn.Open()

            cmd = New OleDbCommand("select * from DATA_COUNTER", cn)

            dr = cmd.ExecuteReader

            While dr.Read()
                TextBox1.Text = dr(1)

                TextBox3.Text = dr(4)
                w.WriteLine(dr(1) & " " & dr(4))
         
                dr.Close()
                cn.Close()
                w.Close()
            End While
        Catch

        End Try
    End Sub
problem 1 : How i write the all Records from the 2 Fields into the text file

problem 2 : This what i get From my Database : "29/07/2008 09:29:52 4"
what i need is : "20080729092952{TAB}4"

10nx for any help you can give me
 
Back
Top