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.
I just keep getting a blank sheet.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)




Reply With Quote