I am getting data from my database and I want to have that data as a table in excel file. So, I have written the following :
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()
There should be a straight obvious way of doing this ?
Dumping a database table to excel sheet ?
[ Should I ? ]
Should I use dataset of something.. ? If yes, how to proceed for that ?
Please help.. I am new to this !!