export to excel from vb.net from sql datareader

Posted by reffer on Stack Overflow See other posts from Stack Overflow or by reffer
Published on 2010-04-02T18:13:27Z Indexed on 2010/04/02 18:33 UTC
Read the original article Hit count: 688

Filed under:
|
|

I have an sql query with sql datareader. i put a for loop for the data reader. now when the data starts coming in from the query i want it to export to excel in the for loop. here's my code

Try Dim SqlStr As String = "", dr As SqlDataReader = Nothing

        ConnectDB(Cnn)
        Str = "query"
        SqlCmd = New SqlCommand(Str, Cnn)
        dr = SqlCmd.ExecuteReader

while dr.read ..EXPORT TO EXCEL do end while does anyone know how to do this?

© Stack Overflow or respective owner

Related posts about excel

Related posts about vb.net