473,685 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

export datatable to excel

cj2
#1 Is there a quick way to export a datatable to an excel file? Or
delimited file?

#2 Where is the appropriate Microsoft monitored group to ask about
writing reports in SQL Reporting services or SQL Server Business
Intelligence Development Studio or whatever it's called?
Sep 11 '08 #1
19 11225
search your system for : DTSWizard.exe

if you have SQLserver

"cj2" <cj*@nospam.nos pamwrote in message
news:OO******** ******@TK2MSFTN GP02.phx.gbl...
#1 Is there a quick way to export a datatable to an excel file? Or
delimited file?

#2 Where is the appropriate Microsoft monitored group to ask about
writing reports in SQL Reporting services or SQL Server Business
Intelligence Development Studio or whatever it's called?
Sep 11 '08 #2
cj2
I should have made this clearer. I mean a datatable in VB.net.

dim mydt as new datatable
myodbcdataadapt er.fill(mydt)

do some processing then export to excel.
Gillard wrote:
search your system for : DTSWizard.exe

if you have SQLserver

"cj2" <cj*@nospam.nos pamwrote in message
news:OO******** ******@TK2MSFTN GP02.phx.gbl...
>#1 Is there a quick way to export a datatable to an excel file? Or
delimited file?

#2 Where is the appropriate Microsoft monitored group to ask about
writing reports in SQL Reporting services or SQL Server Business
Intelligence Development Studio or whatever it's called?
Sep 11 '08 #3
Hello Chris,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

As to your first question, we have the following three solutions to export
the data from a datatable into an Excel file:

1.Using Office automation as Gillard's code shows. In this approach, each
row in the datatable will cost one Excel COM server call. So the speed is a
little slow.

2.We can put the datatable in a System.Web.UI.W ebControls.Data Grid control
and use the DataGrid's RenderControl function to export the data into an
Excel file. There is a sample article about this approach in code project:
http://www.codeproject.com/KB/office...DataTable.aspx

3.We take the Excel file as a database and use OleDbConnection to connect to
it. After that, we can update our datatable to the Excel file database. The
following Microsoft KB article dedicate to this method:
http://support.microsoft.com/kb/316934

As to the second question, we have the managed newsgroup
microsoft.publi c.sqlserver.rep ortingsvcs that targets at issues about SQL
Reporting services.

If you have any future questions, please feel free to let me know.
Best regards,
Ji Zhou (v-****@online.mic rosoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

"cj2" <cj*@nospam.nos pamwrote in message
news:OO******** ******@TK2MSFTN GP02.phx.gbl...
#1 Is there a quick way to export a datatable to an excel file? Or
delimited file?

#2 Where is the appropriate Microsoft monitored group to ask about
writing reports in SQL Reporting services or SQL Server Business
Intelligence Development Studio or whatever it's called?
Sep 12 '08 #4
cj2
In the codeproject article it refers to System.Web.UI.W ebControls.Data Grid()
this doesn't seem to exist in VB2008 or VB2005.

How do I reference this?
"Ji Zhou [MSFT]" wrote:
Hello Chris,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

As to your first question, we have the following three solutions to
export the data from a datatable into an Excel file:

1.Using Office automation as Gillard's code shows. In this approach,
each row in the datatable will cost one Excel COM server call. So the
speed is a little slow.

2.We can put the datatable in a System.Web.UI.W ebControls.Data Grid
control and use the DataGrid's RenderControl function to export the data
into an Excel file. There is a sample article about this approach in
code project: http://www.codeproject.com/KB/office...DataTable.aspx

3.We take the Excel file as a database and use OleDbConnection to
connect to it. After that, we can update our datatable to the Excel file
database. The following Microsoft KB article dedicate to this method:
http://support.microsoft.com/kb/316934

As to the second question, we have the managed newsgroup
microsoft.publi c.sqlserver.rep ortingsvcs that targets at issues about
SQL Reporting services.

If you have any future questions, please feel free to let me know.
Best regards,
Ji Zhou (v-****@online.mic rosoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments
and suggestions about how we can improve the support we provide to you.
Please feel free to let my manager know what you think of the level of
service provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best handled working with a dedicated Microsoft Support Engineer by
contacting Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.

=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

"cj2" <cj*@nospam.nos pamwrote in message
news:OO******** ******@TK2MSFTN GP02.phx.gbl...
>#1 Is there a quick way to export a datatable to an excel file? Or
delimited file?

#2 Where is the appropriate Microsoft monitored group to ask about
writing reports in SQL Reporting services or SQL Server Business
Intelligence Development Studio or whatever it's called?
Sep 18 '08 #5
try
System.Windows. Forms.DataGridV iew

"cj2" <cj*@nospam.nos pamwrote in message
news:u$******** ******@TK2MSFTN GP04.phx.gbl...
In the codeproject article it refers to
System.Web.UI.W ebControls.Data Grid()
this doesn't seem to exist in VB2008 or VB2005.

How do I reference this?
"Ji Zhou [MSFT]" wrote:
>Hello Chris,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

As to your first question, we have the following three solutions to
export the data from a datatable into an Excel file:

1.Using Office automation as Gillard's code shows. In this approach, each
row in the datatable will cost one Excel COM server call. So the speed is
a little slow.

2.We can put the datatable in a System.Web.UI.W ebControls.Data Grid
control and use the DataGrid's RenderControl function to export the data
into an Excel file. There is a sample article about this approach in code
project: http://www.codeproject.com/KB/office...DataTable.aspx

3.We take the Excel file as a database and use OleDbConnection to connect
to it. After that, we can update our datatable to the Excel file
database. The following Microsoft KB article dedicate to this method:
http://support.microsoft.com/kb/316934

As to the second question, we have the managed newsgroup
microsoft.publ ic.sqlserver.re portingsvcs that targets at issues about SQL
Reporting services.

If you have any future questions, please feel free to let me know.
Best regards,
Ji Zhou (v-****@online.mic rosoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please feel free to let my manager know what you think of the level of
service provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

============== =============== =============== ======
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues where an initial response from the community or a Microsoft
Support
Engineer within 1 business day is acceptable. Please note that each
follow up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
============== =============== =============== ======
This posting is provided "AS IS" with no warranties, and confers no
rights.

"cj2" <cj*@nospam.nos pamwrote in message
news:OO******* *******@TK2MSFT NGP02.phx.gbl.. .
>>#1 Is there a quick way to export a datatable to an excel file? Or
delimited file?

#2 Where is the appropriate Microsoft monitored group to ask about
writing reports in SQL Reporting services or SQL Server Business
Intelligenc e Development Studio or whatever it's called?
Sep 18 '08 #6
cj2
I can try but I understood from the article that only the web grid
allowed exporting to excel.

Gillard wrote:
try
System.Windows. Forms.DataGridV iew

"cj2" <cj*@nospam.nos pamwrote in message
news:u$******** ******@TK2MSFTN GP04.phx.gbl...
>In the codeproject article it refers to
System.Web.UI. WebControls.Dat aGrid()
this doesn't seem to exist in VB2008 or VB2005.

How do I reference this?
"Ji Zhou [MSFT]" wrote:
>>Hello Chris,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji
Zhou [MSFT] and I will be working on this issue with you.

As to your first question, we have the following three solutions to
export the data from a datatable into an Excel file:

1.Using Office automation as Gillard's code shows. In this approach,
each row in the datatable will cost one Excel COM server call. So the
speed is a little slow.

2.We can put the datatable in a System.Web.UI.W ebControls.Data Grid
control and use the DataGrid's RenderControl function to export the
data into an Excel file. There is a sample article about this
approach in code project:
http://www.codeproject.com/KB/office...DataTable.aspx

3.We take the Excel file as a database and use OleDbConnection to
connect to it. After that, we can update our datatable to the Excel
file database. The following Microsoft KB article dedicate to this
method: http://support.microsoft.com/kb/316934

As to the second question, we have the managed newsgroup
microsoft.pub lic.sqlserver.r eportingsvcs that targets at issues about
SQL Reporting services.

If you have any future questions, please feel free to let me know.
Best regards,
Ji Zhou (v-****@online.mic rosoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments
and suggestions about how we can improve the support we provide to
you. Please feel free to let my manager know what you think of the
level of service provided. You can send feedback directly to my
manager at: ms****@microsof t.com.

============= =============== =============== =======
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues where an initial response from the community or a Microsoft
Support
Engineer within 1 business day is acceptable. Please note that each
follow up response may take approximately 2 business days as the support
professiona l working with you may need further investigation to reach
the most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best handled working with a dedicated Microsoft Support Engineer by
contacting Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
============= =============== =============== =======
This posting is provided "AS IS" with no warranties, and confers no
rights.

"cj2" <cj*@nospam.nos pamwrote in message
news:OO****** ********@TK2MSF TNGP02.phx.gbl. ..
#1 Is there a quick way to export a datatable to an excel file? Or
delimited file?

#2 Where is the appropriate Microsoft monitored group to ask about
writing reports in SQL Reporting services or SQL Server Business
Intelligen ce Development Studio or whatever it's called?
Sep 18 '08 #7
I have a class to do the job
it is in attachment new.vb

"cj2" <cj*@nospam.nos pamwrote in message
news:ez******** *****@TK2MSFTNG P03.phx.gbl...
I can try but I understood from the article that only the web grid allowed
exporting to excel.

Gillard wrote:
>try
System.Windows. Forms.DataGridV iew

"cj2" <cj*@nospam.nos pamwrote in message
news:u$******* *******@TK2MSFT NGP04.phx.gbl.. .
>>In the codeproject article it refers to
System.Web.UI .WebControls.Da taGrid()
this doesn't seem to exist in VB2008 or VB2005.

How do I reference this?
"Ji Zhou [MSFT]" wrote:
Hello Chris,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji
Zhou [MSFT] and I will be working on this issue with you.

As to your first question, we have the following three solutions to
export the data from a datatable into an Excel file:

1.Using Office automation as Gillard's code shows. In this approach,
each row in the datatable will cost one Excel COM server call. So the
speed is a little slow.

2.We can put the datatable in a System.Web.UI.W ebControls.Data Grid
control and use the DataGrid's RenderControl function to export the
data into an Excel file. There is a sample article about this approach
in code project:
http://www.codeproject.com/KB/office...DataTable.aspx

3.We take the Excel file as a database and use OleDbConnection to
connect to it. After that, we can update our datatable to the Excel
file database. The following Microsoft KB article dedicate to this
method: http://support.microsoft.com/kb/316934

As to the second question, we have the managed newsgroup
microsoft.pu blic.sqlserver. reportingsvcs that targets at issues about
SQL Reporting services.

If you have any future questions, please feel free to let me know.
Best regards,
Ji Zhou (v-****@online.mic rosoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments
and suggestions about how we can improve the support we provide to you.
Please feel free to let my manager know what you think of the level of
service provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

============ =============== =============== ========
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues where an initial response from the community or a Microsoft
Support
Engineer within 1 business day is acceptable. Please note that each
follow up response may take approximately 2 business days as the
support
profession al working with you may need further investigation to reach
the most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best handled working with a dedicated Microsoft Support Engineer by
contacting Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
============ =============== =============== ========
This posting is provided "AS IS" with no warranties, and confers no
rights.

"cj2" <cj*@nospam.nos pamwrote in message
news:OO***** *********@TK2MS FTNGP02.phx.gbl ...
#1 Is there a quick way to export a datatable to an excel file? Or
delimited file?
>
#2 Where is the appropriate Microsoft monitored group to ask about
writing reports in SQL Reporting services or SQL Server Business
Intelligenc e Development Studio or whatever it's called?
Sep 18 '08 #8
Hello Chris,

If we want to use the System.Web.UI.W ebControls in the console or windows
form VB.NET application. We need to add a reference to System.Web assembly.
To reference this assembly in VB.NET 2008, we open the Solution Explorer
Window, right click our project and choose Add Reference option. Then, the
Add Reference dialog pops up. In the .NET tab, we find and select the
System.Web, and click the OK button. Afterwards, we can use the
System.Web.UI.W ebControls.Data Grid.

Please let me know if you have future questions or concerns on this. I will
be more than glad to provide future help!
Best regards,
Ji Zhou (v-****@online.mic rosoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 19 '08 #9
cj2
Thank you very much!

Ji Zhou [MSFT] wrote:
Hello Chris,

If we want to use the System.Web.UI.W ebControls in the console or windows
form VB.NET application. We need to add a reference to System.Web assembly.
To reference this assembly in VB.NET 2008, we open the Solution Explorer
Window, right click our project and choose Add Reference option. Then, the
Add Reference dialog pops up. In the .NET tab, we find and select the
System.Web, and click the OK button. Afterwards, we can use the
System.Web.UI.W ebControls.Data Grid.

Please let me know if you have future questions or concerns on this. I will
be more than glad to provide future help!
Best regards,
Ji Zhou (v-****@online.mic rosoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
Sep 19 '08 #10

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

Similar topics

0
864
by: Jason | last post by:
Can anyone point me to some sample code or tutorial that shows how I can export data from a database to an Excel spreadsheet that is already created on the server? I have an Excel spreadsheet that contains a number of labeled cells and sheets. When someone clicks the "Export to Excel" button on my asp page, I want to export the required data from my sql database to the Excel spreadsheet (putting the data in the appropriate cells and...
6
13132
by: Robin Cushman | last post by:
Hi all, I need some help -- I'm working with an A2K database, using DAO, and am trying to read records into a Crystal Report and then export it to a folder on our network as an Excel spreadsheet. I'm having trouble with my code at the point at which it hits ".ReadRecords" -- the module just runs and runs without generating anything. I've gotten this code to correctly save .rpt files without any data, but not with data, nor have I been...
8
2848
by: DC Gringo | last post by:
I have a simple button that should open another window and export a datagrid to an Excel file. I'm getting: "Name 'window' is not declared." What do I need to declare or import? <INPUT ID="Button5" ONCLICK="Button5_Click" NAME="Button5" TYPE="button" VALUE="Export to Excel"> Sub Button5_Click()
0
2925
by: kieran | last post by:
Hi, I have an 'export to excel' button on my Datagrid. All works well except that on my Datagrid, I have sub total rows. The subtotal rows use colspan so that the subtotals are given above certain columns When I export to excel, I do not have the colspan. As a result, the subtotals appear over the wrong columns in Excel.
13
13218
by: Hemant Sipahimalani | last post by:
The following piece of code is being used to export HTML to excel. HttpContext.Current.Response.ContentType = "application/vnd.ms-excel" HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=ABC.xls") HttpContext.Current.Response.Write(strHTML) HttpContext.Current.Response.End() However when the user tries to save it the Default File Type is Web Page(*.htm; *.html)
6
8551
by: elangovan.cse | last post by:
Hi all, I'm exporting a datagrid to an excel file. I'm using the following source code to export. DataTable dt = new DataTable(); DataAccess.StoredProcedure sproc = new DataAccess.StoredProcedure("sproc_getdata"); sproc.Run(dt);
1
1818
by: elangovan | last post by:
Hi all, I'm exporting a datagrid to an excel file. I'm using the following source code to export. DataTable dt = new DataTable(); DataAccess.StoredProcedure sproc = new DataAccess.StoredProcedure("sproc_getdata"); sproc.Run(dt);
1
7204
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 problem. The problem is that I want to add text above the data grid in the excel sheet. The text already exists on the web page in various panels (there is different text depending on the parameters of the datagrid
0
1561
by: mustaqueahmad | last post by:
Hi All, I am getting export to excel problem when I am giving IPAddress in URL, but it is working correct when am giving localhost and page name. eg : when I am writing My machine IP address and aspx pagename like 192.xxx.xxx.xx/exporttoexcell.aspx then popup page is not working. the popup page is being closed automatically , and export to excel option is not comming. for some reason when it opens within a scripted popup (js:...
0
8577
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9048
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8763
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8774
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7591
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6436
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2199
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.