there are two ways to put data into Excel, that I know of -
- using automation (Excel object model)
- using ADO.NET - treating Excel as a database.
For the latter,
using the Jet OLEDB provider for Excel, you can refer to a named range like
this:
select * from [materials$]
eg,
http://tinyurl.com/6yglu
or you can Create a sheet by running a CREATE TABLE command - the sheet is
the name you provide for the table.
for the former, there are lots of examples, I think you can find one in the
..NET SDK quickstart which is optionally installed when you install the .NET
SDK.
-D
"Niyazi" <Niyazi@discussions.microsoft.com> wrote in message
news:15F85DA6-0133-402A-BAB2-CC5F487E5F39@microsoft.com...[color=blue]
> Hi,
>
> I have to retrieve a data from AS400 DB2 and after working with data I
> have
> to export into one of existing Excel file.
>
> I can connect into specific library in AS400 DB2 using AS400 Client-Access
> v5.2 program using (in VB.NET) ODBC driver (DSN Name .) . I can retrieve
> datam work on it using VB.NET and I can send into 'NEW' Excel file.
>
> My first problem starts here:
> 1- Every time I access in to DB2 I open the connection to retrieve the
> data
> from specific table and close the connection.
> 2- Every connection I use SQL command such as SUM. AVG etc. Most of the
> time
> (%90) retrieving the data from AS400 DB2 takes some time. (between
> 15second
> to 55 second)
> 3- I have to do this operation at least 50 times at most.
> 4- I am using VB.NET to achieve this operation.
>
> My first question is:
> - I want to put some information on label which resides on main Form that
> shows user about current activity. Such as ("Retrieving data for DEN60"..)
> and so on.
> I have 50 tables that I have to get their sum, avg, or something similar.
> So
> I want some information that tells user what the program is doing.
> Unfortunately I do not know how to achieve it?
>
> Now my second problem is this:
> 1- I have a pre-define Excel file and has only one worksheet and its tab
> it
> show AC2004 instead of Sheet1.
> 2- I have to send some data into this sheet (respectively into E11, G11
> and
> I11 cells)
> 3- After sending the data I have to close the Excel and warn the user that
> data save into existing Excel file.
> Again I do not know how to do this.
>
> I search and study about Excel Object. So I can retrieve data from AS400
> DB2
> and send the data into any cell in new excel file but I am having
> difficulty
> to achieve same operation when the end result must be existing excel file
> in
> specific sheet and specific cell.
>
> I thank you in advance that finding time to read my post and I hope you
> might find time to help me.
>
> Regards.
> Niyazi[/color]