Results 1 to 12 of 12

Thread: Re: Write data to Excel VB.Net [2005] (Resolved)

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    259

    Re: Write data to Excel VB.Net [2005] (Resolved)

    I am trying to use this code and am not able to get the data from the dataset into the datatable that I need for the export.

    Code:
            Dim cnn As New SqlConnection(strCon)
            Dim cmd As New SqlCommand
            Dim da As New SqlDataAdapter
            Dim ds As New DataSet
            'Try
            cmd = cnn.CreateCommand
            cmd.CommandText = "SELECT StoreId, PurchaseOrderNumber....."
            da.SelectCommand = cmd
            da.Fill(ds, "PurchaseOrders")
            dgvPoNumbers.DataSource = ds
            dgvPoNumbers.DataMember = "PurchaseOrders"
    
            Dim poTable As DataTable = ds.Tables.Add("OrderExport")
            Export("c:\myFile.xls", poTable)
    I just keep getting a blank sheet.
    Last edited by FastEddie; Mar 16th, 2007 at 07:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width