Click here to Skip to main content
12,241,949 members (43,336 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0
please help me sir...


thank you
praveen
Posted 15-Nov-12 20:42pm
Comments
Krunal R 16-Nov-12 1:43am
   
Not getting your question...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I would select everything from the table and use a stream writer to export it to csv

        Dim cn As New OleDbConnection
        Dim qry As String = "SELECT * FROM YOURTABLE"
        Dim myReader As OleDbDataReader
Dim myWriter As New StreamWriter(DIRECTORY AND NAME OF THE FILE)
 
        Try
 
            cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & PATH TO YOUR TABLE& ";Persist Security Info=True"
 
            cn.Open()
 
            Using cmd As New OleDbCommand(qry, cn)
 
                myReader = cmd.ExecuteReader()
                myWriter.Writeline(ALL YOU HEADERS SEPERATED BY COMMAS)
                While myReader.Read()
                    string line = myReader(FIELD IN YOUR TABLE) +
                    "," + myReader(FIELD IN YOUR TABLE)
 
                    myWriter.Writeline(line)
                End While
 
            End Using
 
            myReader.Close()
 
            cn.Close()
        Catch ex As Exception
       
        End Try

is this what you meant?
  Permalink  
v4
Comments
Tinier 18-Nov-12 23:21pm
   
he needs c#, not vb.net
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100