Hi,
My application is in VS2008 and coded in Vb.net.
I have my database in Sql Server 2005.I have a Database table say Table1 in My Database named Test.
Now i want to export the data in Table1 to a MS-Excel(.xls) file on the click of a button.
An excel file should be generated after the user clicks on the button and the generated Excel file should have the data that is present in Table1.
Can anyone provide me with a link or some helpful code to do this.
My code is in Vb.net
Thanks.
Ehtesham Siddiq
0
Junior Poster in Training
Recommended Answers
Jump to PostIf ((DataGridView1.Columns.Count = 0) Or (DataGridView1.Rows.Count = 0)) Then Exit Sub End If 'Creating dataset to export Dim dset As New DataSet 'add table to dataset dset.Tables.Add() 'add column to that table For i As Integer = 0 To DataGridView1.ColumnCount - 1 dset.Tables(0).Columns.Add(DataGridView1.Columns(i).HeaderText) Next 'add rows to …
Jump to PostCool... :) Then plz mark thread as solved.
Jump to PostThen give as
For ii As Integer = 1 To 22
All 9 Replies
Pgmer
50
Master Poster
Featured Poster
Ehtesham Siddiq
0
Junior Poster in Training
Ehtesham Siddiq
0
Junior Poster in Training
Pgmer
50
Master Poster
Featured Poster
Ehtesham Siddiq
0
Junior Poster in Training
Pgmer
50
Master Poster
Featured Poster
Ehtesham Siddiq
0
Junior Poster in Training
Rox Vi
0
Newbie Poster
Pgmer
50
Master Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.