0
成果转化的工具,我正在写一个工具导入数据库查询结果到Excel中VB.NET导入查询通过VB.NET
我尝试下面的代码。它不工作。
With objApp.ActiveSheet.QueryTables.Add(Connection:="ODBC;DSN=Build_statistics;", _
Destination:=objApp.Range("G15"))
.CommandText = "SELECT * from mytable"
.Name = "Query"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = Microsoft.Office.Interop.Excel.XlCellInsertionMode.xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
**.Refresh(BackgroundQuery:=False)** 'I am getting error here
End With
它在VBA中工作正常,但在VB.NET中没有问题。
VBA不是VB.NET,它们是非常不同的语言。 – Oded 2010-02-08 11:01:19