----------------------------------------------------------- New Message on BDOTNET
----------------------------------------------------------- From: LovedJohnySmith Message 2 in Discussion Hey Guru! We can export the data to Excel by using following techiniques. 1. Use Automation to Transfer Data Cell by Cell With Automation, you can transfer data to a worksheet one cell at a time: 2. Use Automation to Transfer an Array of Data to a Range on a Worksheet You can transfer an array of data to a range of multiple cells at one time: 3. Use Automation to Transfer an ADO Recordset to a Worksheet Range The object models for Excel 2000, Excel 2002 and Excel 2003 provide the CopyFromRecordset method for transferring an ADO recordset to a range on a worksheet. The following code illustrates how to automate Excel to transfer the contents of the Orders table in the Northwind sample database by using the CopyFromRecordset method: 4. Use Automation to Create a QueryTable Object on a Worksheet A QueryTable object represents a table that is built from data that is returned from an external data source. When you automate Excel, you can create a QueryTable by providing a connection string to an OLE DB or an ODBC data source and a SQL string. Excel generates the recordset and inserts the recordset into the worksheet at the location that you specify. QueryTable objects offer the following advantages over the CopyFromRecordset method: � Excel handles the creation of the recordset and its placement on the worksheet. � You can save the query with the QueryTable object and refresh it later to obtain an updated recordset. � When a new QueryTable is added to your worksheet, you can specify that data that already exists in cells on the worksheet be shifted to handle the new data (for more information, see the RefreshStyle property). 5. Use the Windows Clipboard You can use the Windows Clipboard to transfer data to a worksheet. To paste data into multiple cells on a worksheet, you can copy a string in which columns are delimited by TAB characters, and rows are delimited by carriage returns. The following code illustrates how Visual C# .NET can use the Windows Clipboard to transfer data to Excel: 6. Create a Delimited Text File that Excel Can Parse into Rows and Columns Excel can open tab- or comma-delimited files and correctly parse the data into cells. You can use this feature when you want to transfer a large quantity of data to a worksheet while using little, if any, Automation. This may be a good approach for a client-server program because the text file can be generated server-side. You can then open the text file at the client, using Automation where it is appropriate. 7. Transfer Data to a Worksheet by Using ADO.NET You can use the Microsoft Jet OLE DB provider to add records to a table in an existing Excel workbook. A table in Excel is merely a range of cells; the range may have a defined name. Typically, the first row of the range contains the headers (or field names), and all later rows in the range contain the records. Interesting rite! You wanna know more information on this? see the following URL. http://support.microsoft.com/default.aspx?scid=kb;en-us;306023 Thanx, Smith ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/bdotnet/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
