Export data to excel

how do i export data from visual basic to ms-excel be it the data is stored in an access database or sql database

Comments

  • [b][red]This message was edited by Barkeeper at 2006-5-9 7:21:54[/red][/b][hr]
    : how do i export data from visual basic to ms-excel be it the data is stored in an access database or sql database
    :
    :


    Look up the SQL-Language --> "SELECT ... INTO .... "-Statement!
    You'll need an installed ISAM-Driver for Excel! I have a example at home (at work right now). i will post it tomorrow.

    Zvoni
    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein



  • [code]
    Public Sub Export(ByVal Destination As String, ByVal ExtDatabase As String, ByVal ISAMType As String, Byval Source as String)
    Dim DummySQL As String

    DummySQL = "SELECT * INTO [" & Destination & "] IN '" & ExtDatabase & "' '" & ISAMType & "' FROM " & Source

    [green]'Here Code for Executing the SQL-Statement[/green]

    End Sub

    Public Sub ExportExcel()
    Dim DummySQL As String

    DummySQL = "SELECT * INTO [Sheet1$] IN 'c: est.xls' 'Excel 8.0;' FROM MySourceInDB"

    [green]'Here Code for Executing the SQL-Statement[/green]

    End Sub

    [/code]

    : [b][red]This message was edited by Barkeeper at 2006-5-9 7:21:54[/red][/b][hr]
    : : how do i export data from visual basic to ms-excel be it the data is stored in an access database or sql database
    : :
    : :
    :
    :
    : Look up the SQL-Language --> "SELECT ... INTO .... "-Statement!
    : You'll need an installed ISAM-Driver for Excel! I have a example at home (at work right now). i will post it tomorrow.
    :
    : Zvoni
    : ------------------------------------------
    : Only stupidity of mankind and the universe
    : are infinite, but i'm not sure concerning
    : the universe. A. Einstein
    :
    :
    :
    :

    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • Hi Barkeeper

    i tried the sql statment given by you (in query analyzer), but i get an error
    Incorrect syntax near the keyword 'IN'.
    the query was
    SELECT * INTO [Sheet1$] IN 'c: est.xls' 'Excel 8.0;' FROM ACNAME

    did i do something wrong... ???

    AWAHI

    : [code]
    : Public Sub Export(ByVal Destination As String, ByVal ExtDatabase As String, ByVal ISAMType As String, Byval Source as String)
    : Dim DummySQL As String
    :
    : DummySQL = "SELECT * INTO [" & Destination & "] IN '" & ExtDatabase & "' '" & ISAMType & "' FROM " & Source
    :
    : [green]'Here Code for Executing the SQL-Statement[/green]
    :
    : End Sub
    :
    : Public Sub ExportExcel()
    : Dim DummySQL As String
    :
    : DummySQL = "SELECT * INTO [Sheet1$] IN 'c: est.xls' 'Excel 8.0;' FROM MySourceInDB"
    :
    : [green]'Here Code for Executing the SQL-Statement[/green]
    :
    : End Sub
    :
    : [/code]
    :
    : : [b][red]This message was edited by Barkeeper at 2006-5-9 7:21:54[/red][/b][hr]
    : : : how do i export data from visual basic to ms-excel be it the data is stored in an access database or sql database
    : : :
    : : :
    : :
    : :
    : : Look up the SQL-Language --> "SELECT ... INTO .... "-Statement!
    : : You'll need an installed ISAM-Driver for Excel! I have a example at home (at work right now). i will post it tomorrow.
    : :
    : : Zvoni
    : : ------------------------------------------
    : : Only stupidity of mankind and the universe
    : : are infinite, but i'm not sure concerning
    : : the universe. A. Einstein
    : :
    : :
    : :
    : :
    :
    : ------------------------------------------
    : Only stupidity of mankind and the universe
    : are infinite, but i'm not sure concerning
    : the universe. A. Einstein
    :
    :

  • Sorry, my mistake.

    the $-Character has to be left out.

    SELECT * INTO [Sheet1] IN 'c: est.xls' 'Excel 8.0;' FROM ACNAME

    should do the trick. Note: Sheet1 not Sheet1$

    I tried it with one of my own Access-Databases and it worked this way

    Zvoni



    : Hi Barkeeper
    :
    : i tried the sql statment given by you (in query analyzer), but i get an error
    : Incorrect syntax near the keyword 'IN'.
    : the query was
    : SELECT * INTO [Sheet1$] IN 'c: est.xls' 'Excel 8.0;' FROM ACNAME
    :
    : did i do something wrong... ???
    :
    : AWAHI
    :
    : : [code]
    : : Public Sub Export(ByVal Destination As String, ByVal ExtDatabase As String, ByVal ISAMType As String, Byval Source as String)
    : : Dim DummySQL As String
    : :
    : : DummySQL = "SELECT * INTO [" & Destination & "] IN '" & ExtDatabase & "' '" & ISAMType & "' FROM " & Source
    : :
    : : [green]'Here Code for Executing the SQL-Statement[/green]
    : :
    : : End Sub
    : :
    : : Public Sub ExportExcel()
    : : Dim DummySQL As String
    : :
    : : DummySQL = "SELECT * INTO [Sheet1$] IN 'c: est.xls' 'Excel 8.0;' FROM MySourceInDB"
    : :
    : : [green]'Here Code for Executing the SQL-Statement[/green]
    : :
    : : End Sub
    : :
    : : [/code]
    : :
    : : : [b][red]This message was edited by Barkeeper at 2006-5-9 7:21:54[/red][/b][hr]
    : : : : how do i export data from visual basic to ms-excel be it the data is stored in an access database or sql database
    : : : :
    : : : :
    : : :
    : : :
    : : : Look up the SQL-Language --> "SELECT ... INTO .... "-Statement!
    : : : You'll need an installed ISAM-Driver for Excel! I have a example at home (at work right now). i will post it tomorrow.
    : : :
    : : : Zvoni
    : : : ------------------------------------------
    : : : Only stupidity of mankind and the universe
    : : : are infinite, but i'm not sure concerning
    : : : the universe. A. Einstein
    : : :
    : : :
    : : :
    : : :
    : :
    : : ------------------------------------------
    : : Only stupidity of mankind and the universe
    : : are infinite, but i'm not sure concerning
    : : the universe. A. Einstein
    : :
    : :
    :
    :

    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • I find a way to use C# to export data to Excel.
    And I get the method from a blog
    [link=http://janewdaisy.wordpress.com/2011/02/25/fast-export-data-from-database-to-excel-and-generate-chart-without-automation/]http://janewdaisy.wordpress.com/2011/02/25/fast-export-data-from-database-to-excel-and-generate-chart-without-automation/[/link]
    I think that the method in this blog may be useful for you, so I recommand it to you.
    Hope Helpful!
  • all of what you said really helps me
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories