Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2006, 12:35 PM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADO Problem fro extracting excell data

Hi

I have some problem with extracting excell data. It alwasy miss the first row. Any one have any Idea what is the problem? Is it a DOTNET bug?
**********CODE***************
String temp="Select * From ["+ this.txtSheet.Text+"$"+this.txtStarting_cell.Text+ ":"+this.txtEnd_cell.Text+"]";
String path=this.txtSaveF.Text;
String temprec;
System.Data.DataSet DS;
System.Data.OleDb.OleDbDataAdapter MyCommand;
System.Data.OleDb.OleDbConnection MyConnection;
MyConnectHi

I have some problem with extracting excell data. It alwasy miss the first row. Any one have any Idea what is the problem? Is it a DOTNET bug
**********CODE***************
String temp="Select * From ["+ this.txtSheet.Text+"$"+this.txtStarting_cell.Text+ ":"+this.txtEnd_cell.Text+"]";
String path=this.txtSaveF.Text;
String temprec;
System.Data.DataSet DS;
System.Data.OleDb.OleDbDataAdapter MyCommand;
System.Data.OleDb.OleDbConnection MyConnection;
MyConnection = new System.Data.OleDb.OleDbConnection( "provider=Microsoft.Jet.OLEDB.4.0; " +"data source=" +this.txtOpenF.Text + "; Extended Properties=Excel 8.0; ");
// Select the data from Sheet1 of the workbook.
MyCommand = new System.Data.OleDb.OleDbDataAdapter(temp, MyConnection);
DS = new System.Data.DataSet();
MyCommand.Fill(DS);ion = new System.Data.OleDb.OleDbConnection( "provider=Microsoft.Jet.OLEDB.4.0; " +"data source=" +this.txtOpenF.Text + "; Extended Properties=Excel 8.0; ");
// Select the data from Sheet1 of the workbook.
MyCommand = new System.Data.OleDb.OleDbDataAdapter(temp, MyConnection);
DS = new System.Data.DataSet();
MyCommand.Fill(DS);

 
Old May 20th, 2006, 02:50 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You may want to look here: http://www.connectionstrings.com/ under Excel.

You can see the connectionstring has an HDR attribute. When set to False, the first row is not assumed to contain the headers. Maybe that helps.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004





Similar Threads
Thread Thread Starter Forum Replies Last Post
populate a drop list fro a data table greenbriar ADO.NET 2 July 22nd, 2008 10:18 PM
Which data provider fro dbf file format in vb kau_shuk Pro VB.NET 2002/2003 1 November 29th, 2006 08:40 PM
problem Extracting Data using HTML Object Library method VB How-To 0 May 12th, 2006 02:52 AM
Export data to several excell sheets at will milocold Crystal Reports 0 November 16th, 2005 11:42 AM
Import Excell Data into Access Mitch Access 4 February 15th, 2005 10:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.