By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,045 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,045 IT Pros & Developers. It's quick & easy.

How to Export Data Display from DataGrid to CSV or XLS

P: 2
I am new in visual basic and I want to make an application for extracting records from DataGrid to Excel using Visual Basic and my database is MS SQL. Please somebody help me on how to do this...thanks a lot
May 8 '07 #1
Share this Question
Share on Google+
2 Replies


P: 10
I am new in visual basic and I want to make an application for extracting records from DataGrid to Excel using Visual Basic and my database is MS SQL. Please somebody help me on how to do this...thanks a lot

you can try this link
http://www.thescripts.com/forum/thread637955.html
May 8 '07 #2

P: 3
make a object like this
Dim objexcel As Object
then u have to creat connection
and then select the fields from ur data base u want to display
then set the object
Set objexcel = CreateObject("Excel.sheet")
objexcel.Application.Cells(1, 1).Value = "Serial_no"
this will display the headers in your excel sheet
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;
this will display the value of the fields in the excel sheet...
For i = 0 To rsreport.Fields.Count - 1
objexcel.Application.Cells(m, j).Value = rsreport.Fields(i).Value
j = j + 1
DoEvents
Next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
hope it will help
May 8 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.