比如
Dim cmd As New SQLCommand
'cmd.ConnectionName = "数据源名称"
Dim nms() As String = {"产品","数量","单价","金额","日期"}
cmd.CommandText = "Select 产品,数量,单价, 数量 * 单价 As 金额,日期 From {订单主表} Where 客户 = 'CS01' "
Dim dt As DataTable = cmd.ExecuteReader()
Dim Book As New XLS.Book
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Style As Xls.Style = Book.NewStyle
Style.BackColor = Color.Red
For c As Integer = 0 To nms.Count -1
Sheet(0, c).Value = nms(c)
Next
For r As Integer = 0 To dt.DataRows.Count - 1
For c As Integer = 0 To nms.Count -1
Sheet(r +1, c).Value = dt.DataRows(r)(nms(c))
Next
Next
Dim nms2() As String = {"第一列","第二列"}
cmd.CommandText = "Select 第一列,第二列 From {订单出货明细} Where 客户 = 'CS01' "
dt = cmd.ExecuteReader()
Book.Sheets.Add() '增加一个工作表
Sheet = Book.Sheets(1)
For c As Integer = 0 To nms2.Count -1
Sheet(0, c).Value = nms2(c)
Next
For r As Integer = 0 To dt.DataRows.Count - 1
For c As Integer = 0 To nms2.Count -1
Sheet(r +1, c).Value = dt.DataRows(r)(nms2(c))
Next
Next
'打开工作簿
Book.Save("c:\reports\test.xls")
Dim Proc As New Process
Proc.File = "c:\reports\test.xls"
Proc.Start()