我正在从我的数据库中获取数据,并且我希望将这些数据作为 Excel 文件中的表格。所以,我写了以下内容:
Dim sheetToPopulate As Excel.Worksheet = getSheet()
Dim reader As OleDbDataReader
Dim query As String = "SELECT * FROM dataTable"
Dim cmd As New OleDbCommand(query, oleConn)
Dim reader As OleDbDataReader
oleConn.Open()
reader = cmd.ExecuteReader()
Do While reader.Read()
// How use the reader to populate the sheet at once.
// I have the sheet object as sheetToPopulate.
// cell.Vaule = reader.GetString(0) ' It would be very in-efficient and complex.
// How can I dump the table to my excel sheet ?
Loop
reader.Close()
oleConn.Close()
应该有一种直接明显的方法吗?
将数据库表转储到 excel 表?
[ 我是不是该 ?]
Should I use dataset of something.. ? If yes, how to proceed for that ?
请帮忙..我是新手!