473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to Export Data Display from DataGrid to CSV or XLS

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
2 3158
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
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

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

Similar topics

1
by: Matt | last post by:
I have an ASP page that calls ASP routines that I created that execute a database query and return the results to a recordset. I then iterate through the recordset and display the data in a table....
8
by: Arvind P Rangan | last post by:
Hi all, Have you worked on any project or example where in we can export data to Word Format with Page Brakes and Header & Footer Template. This is very important for my assignment. Thanks...
6
by: Eric | last post by:
Dear All, I want to export datagrid content to a Excel file, the code just like below: Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" Me.EnableViewState = False Dim...
2
by: Bidarkota | last post by:
Hi, I have a DataGrid in which there are some images and Data are displayed and in the webform.asp page i am using some stylesheets. when i export the datagrid all the images are also exported...
8
by: chreo | last post by:
I would like to export earnigs of employees from datagrid to EXCEL. for example: __________________________ |..name.............|..money...............| -----------------------------------...
6
by: Sridhar | last post by:
Hi, I have to export data inside the datagrid into an excel worksheet. I have to do this on button click event. I am trying to do like this. First get the DataTable from the datagrid and...
4
by: Amirallia | last post by:
Hello Here's my code to export a datagrid to Exel : Response.Clear() Response.Buffer = True Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" Dim monStringWriter As...
4
by: amitmnagarwal | last post by:
I have a page where i export to excel the content of Page 1 following code is written on page 2 to generate the excel Response.Buffer = True Response.ContentType = "application/vnd.ms-excel"...
1
by: johnlim20088 | last post by:
Hi All, I does have a question about export datagrid data to csv. Well, I know the common solution is 1) select the data again and put in the datatable, then export to csv. BUT I don't want...
1
by: JawzX01 | last post by:
Hello All, First, thank you for any help you can provide. I'm trying to do a simple export to excel. I've used the classic code that is all over the internet, and of course it worked without a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.