473,804 Members | 4,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export to excel without using office automation

I searched from previous post and got that there is a solution which export
the data to export without using Excel auotmation.

However, my database is SQL server, How can I amend objCmd.commandT est ??
I try the following insert statment but fail
"INSERT INTO [Sheet1$] SELECT * FROM
[ODBC;Driver={SQ LServer};Server =(210.22.14.201 );Database=DTS_ ACCOUNT_HK;Trus ted_Connection= yes].[arinvinfo];"
// Establish a connection to the data source.(copy from previous post)
System.Data.Ole Db.OleDbConnect ion objConn = new
System.Data.Ole Db.OleDbConnect ion(
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" + m_strSampleFold er +
"Book7.xls;Exte nded Properties=Exce l 8.0;");
objConn.Open();

// Add two records to the table named 'MyTable'.
System.Data.Ole Db.OleDbCommand objCmd = new
System.Data.Ole Db.OleDbCommand ();
objCmd.Connecti on = objConn;
objCmd.CommandT ext = "Insert into MyTable (FirstName, LastName)" +
" values ('Bill', 'Brown')";
objCmd.ExecuteN onQuery();
objCmd.CommandT ext = "Insert into MyTable (FirstName, LastName)" +
" values ('Joe', 'Thomas')";
objCmd.ExecuteN onQuery();

// Close the connection.
objConn.Close() ;
May 16 '06 #1
4 2506
On Tue, 16 May 2006 22:03:59 +0800, "Agnes" <ag***@dynamict ech.com.hk> wrote:

¤ I searched from previous post and got that there is a solution which export
¤ the data to export without using Excel auotmation.
¤
¤ However, my database is SQL server, How can I amend objCmd.commandT est ??
¤ I try the following insert statment but fail
¤ "INSERT INTO [Sheet1$] SELECT * FROM
¤ [ODBC;Driver={SQ LServer};Server =(210.22.14.201 );Database=DTS_ ACCOUNT_HK;Trus ted_Connection= yes].[arinvinfo];"
¤

What is the error?
Paul
~~~~
Microsoft MVP (Visual Basic)
May 16 '06 #2
There is an error ODBC {SQLServer}(IP. ....) connection fail
"Paul Clement" <Us************ ***********@sws pectrum.com>
???????:5b***** *************** ************@4a x.com...
On Tue, 16 May 2006 22:03:59 +0800, "Agnes" <ag***@dynamict ech.com.hk>
wrote:

¤ I searched from previous post and got that there is a solution which
export
¤ the data to export without using Excel auotmation.
¤
¤ However, my database is SQL server, How can I amend objCmd.commandT est
??
¤ I try the following insert statment but fail
¤ "INSERT INTO [Sheet1$] SELECT * FROM
¤
[ODBC;Driver={SQ LServer};Server =(210.22.14.201 );Database=DTS_ ACCOUNT_HK;Trus ted_Connection= yes].[arinvinfo];"
¤

What is the error?
Paul
~~~~
Microsoft MVP (Visual Basic)

May 16 '06 #3
Agnes,

Here is a link on how to create a spreadsheet with an xml
transform. The sample is for a web application but will work with a windows
forms application.

http://support.microsoft.com/default...b;en-us;319180

Ken
--------------------

"Agnes" wrote:
I searched from previous post and got that there is a solution which export
the data to export without using Excel auotmation.

However, my database is SQL server, How can I amend objCmd.commandT est ??
I try the following insert statment but fail
"INSERT INTO [Sheet1$] SELECT * FROM
[ODBC;Driver={SQ LServer};Server =(210.22.14.201 );Database=DTS_ ACCOUNT_HK;Trus ted_Connection= yes].[arinvinfo];"
// Establish a connection to the data source.(copy from previous post)
System.Data.Ole Db.OleDbConnect ion objConn = new
System.Data.Ole Db.OleDbConnect ion(
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" + m_strSampleFold er +
"Book7.xls;Exte nded Properties=Exce l 8.0;");
objConn.Open();

// Add two records to the table named 'MyTable'.
System.Data.Ole Db.OleDbCommand objCmd = new
System.Data.Ole Db.OleDbCommand ();
objCmd.Connecti on = objConn;
objCmd.CommandT ext = "Insert into MyTable (FirstName, LastName)" +
" values ('Bill', 'Brown')";
objCmd.ExecuteN onQuery();
objCmd.CommandT ext = "Insert into MyTable (FirstName, LastName)" +
" values ('Joe', 'Thomas')";
objCmd.ExecuteN onQuery();

// Close the connection.
objConn.Close() ;

May 16 '06 #4
On Tue, 16 May 2006 22:51:52 +0800, "Agnes" <ag***@dynamict ech.com.hk> wrote:

¤ There is an error ODBC {SQLServer}(IP. ....) connection fail
¤

That would seem to indicate a problem with the connection string or SQL Server configuration.

You might want to check out the connection string requirements for connecting via an IP address:

http://www.carlprothman.net/Default....erForSQLServer
Paul
~~~~
Microsoft MVP (Visual Basic)
May 18 '06 #5

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

Similar topics

5
6563
by: Michael G. Schneider | last post by:
I know that using Word Automation inside an ASP page is no good idea. Anything I want to do in the current project is: open document, change some text, save and close document. Basically changing some variables, consting of a name embraced by special chars, to some value. As for example: change "" to "Michael". Does anybody know whether there is a way for achieving this with basic "file input / output". Can I regard a Word document as...
3
2851
by: Whoever | last post by:
To create Excel file, you can Add Reference Visual Studio.NET, browse to ... and then select Microsoft.Office.Interop.Excel, etc. It endsup some reference to GUID in project file. You can then import namespace and create Excel file etc. Is it possible to do this in one aspx page without using VS project and code behind? Thanks
3
9250
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works only exporting to single worksheet. but i need to export data to multiple worksheets. it is very urgent to us. so please help me in code.
2
1836
by: Alex Maghen | last post by:
Hi. I've seen several KBs on using .NET for MS Office Automation. But I have a particular question: I am developing a somewhat stand-alone .ASPX page which will need to do some relatively simple MS Office Automation (Office 2003+). The .ASPX page is not part of a Web Forms Visual Studio project. It's just a stand-alone file. And therefore, there is not "References" setting or anything because there's no Visual Studio project. My...
12
1649
by: Tomas | last post by:
Hi, I have worked with VB.NET for half a year (semi-newbie). Currently I am looking around for some books for those that crossed the starting hurdle. There are too many books out there-make choosing, a bit of a gamble. If you have experience of good VB.NET books on general and office automattion, you could recommend, it would be greatly appreciated.
4
7229
by: mina | last post by:
One of my client want to export data into excel file but he can not installed office just installed excel and want to export file into ..xls format at that time he got error .... Retrieving the COM class factory for component with CLSID{00024500-0000-0000-C000-000000000046}failed due to the following error.80040154 i hope any one help me which ddl. require to avoid this error without installing whole office or is this possible to allow...
4
8553
by: =?Utf-8?B?UHJpeWE=?= | last post by:
Hi, I'm developing a webservice whicg reads data from a database and exports to a excel sheet. This applciation works if i have MS Office installed in my system . Since i'm unable to install MS Office in teh server is there any alternate way to program this. Thanks in advance Priya
0
1389
by: Bullfrog | last post by:
My office application is really slow on Windows XP! First, some backgroud stuff. The MSAccess system that we use was developed while using Windows 2000, and Office 2000. At our new location, we are using office 2003 and XP. I did not convert the database to 2003 since a few of our staff have laptops with windows 2000. I have quite a few functions/macros in MSAccess that outputs to ms
0
9710
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
9589
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
10593
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...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10329
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
6858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.