473,395 Members | 1,774 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,395 software developers and data experts.

How to Create Excel File(.xls) from VB.Net App

Hi All,

Can anyone tell me how to create an Excel (.xls) file from a VB.Net app? I
have a SQL Server database that contains a table with the data I want to
export. How do I create the file? Any code samples?

Thanks for your help!
Jul 21 '05 #1
2 12460

Hi..

http://www.vbdotnetheaven.com/Code/Jul2003/2124.asp

HTH

With Best Regards
Naveen K S

"Cathy" wrote:
Hi All,

Can anyone tell me how to create an Excel (.xls) file from a VB.Net app? I
have a SQL Server database that contains a table with the data I want to
export. How do I create the file? Any code samples?

Thanks for your help!

Jul 21 '05 #2
On Wed, 16 Feb 2005 16:55:29 -0500, "Cathy" <cm******@co.dutchess.ny.us> wrote:

¤ Hi All,
¤
¤ Can anyone tell me how to create an Excel (.xls) file from a VB.Net app? I
¤ have a SQL Server database that contains a table with the data I want to
¤ export. How do I create the file? Any code samples?

See if the following works for you:

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\Orders.xls;Extended Properties=""Excel 8.0;HDR=NO"""

Dim ExcelConnection As New System.Data.OleDb.OleDbConnection(ConnectionString )
ExcelConnection.Open()

Dim ExcelCommand As System.Data.OleDb.OleDbCommand = ExcelConnection.CreateCommand()

ExcelCommand.CommandText = "SELECT * INTO [Orders] FROM [Orders] IN '' [ODBC;Driver={SQL
Server};Server=(local);Database=Northwind;Trusted_ Connection=yes];"
ExcelCommand.CommandType = CommandType.Text
ExcelCommand.ExecuteNonQuery()

ExcelConnection.Close()
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pravin | last post by:
Hi, I want to know the APIs provided for c++ (By any OS) to convert a file from .xls to .xml format. Or if there is any tutorial or code snipped already there in net, will also do. Pravin.
0
by: New comer | last post by:
Hi I'd like to know how to use c# form to call excel file. Like when I click a button, the .xls file opened, and some data in the textboxes put into the excel cells. Thanks
2
by: Cathy | last post by:
Hi All, Can anyone tell me how to create an Excel (.xls) file from a VB.Net app? I have a SQL Server database that contains a table with the data I want to export. How do I create the file? Any...
0
by: Mike | last post by:
Hi, Does any body using Aspose.Cells? Any recommendation, bugs, easy to use? Thanks, Michael
1
by: Eran.Yasso | last post by:
Hi, Can anyone please tell me how can i create xls file? i then need to write to it. I am creating the file using File.Create(file.xls); but ican't acces the file. i gt error that the file is...
1
by: treybraid | last post by:
My Flash file is a GameCenter where team standings are kept.. I have it set up right now with the master spreadsheet programmed that is linked to a dummy sheet that is saved as a CVS doc and loaded...
2
by: treybraid | last post by:
My Flash file is a GameCenter where team standings are kept.. I have it set up right now with the master spreadsheet programmed that is linked to a dummy sheet that is saved as a CVS doc and loaded...
3
by: PW | last post by:
Does the worksheet have to be exported to a CSV file first or can Access import directly from an Excel workbook (.xls)? Thanks, -paulw
3
risk32
by: risk32 | last post by:
As far as I know, this has been tried MANY times without success. Or, at least without the Web Components loaded on a server. But, I'll go ahead and ask just in case someone can point me in the right...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.