I'm new to vb.net need help.Excel

audreyeliza

New member
Joined
Jan 13, 2006
Messages
1
Programming Experience
Beginner
hi,I'm new to vb.nethow to export XML data from a datagrid to excel sheet?thanks.
 
Dim dbcon As OleDbConnection = New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\(ur xcel sheet name).XLS;Extended Properties=Excel 8.0;")
Dim cmd As oledbCommand = New oledbCommand("select * from [sheet1$]", dbcon)
Dim ds As New DataSet()
Dim da As oledbDataAdapter = New oledbDataAdapter()
da.SelectCommand = cmd
da.fill(ds)
datagrid1.datasource=ds

try this code i have not tested hope it works
 
Back
Top