Hi, i am using this code and work successfully.
*public static DataTable ExecuteReaderExcel(string source, string commandText) { string connectionstroledb = Connection.GetExcelConnectionString(source); OleDbConnection oconn = new OleDbConnection(connectionstroledb); //if (oconn.State == ConnectionState.Open) oconn.Close(); // Open For Sheet Name Codding //oconn.Open(); //DataTable dtExcelSchema; //dtExcelSchema = oconn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); //string SheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString(); //oconn.Close(); oconn.Open(); OleDbCommand ocmd = new OleDbCommand(commandText, oconn); //OleDbCommand ocmd = new OleDbCommand("SELECT * From [" + SheetName + "]", oconn); //OleDbDataReader odr = ocmd.ExecuteReader(); OleDbDataAdapter oleda = new OleDbDataAdapter(); oleda.SelectCommand = ocmd; DataTable dt = new DataTable(); oleda.Fill(dt); //dt.Load(odr); oconn.Close(); return dt; }* On Sat, Aug 18, 2012 at 6:26 PM, Stephen Russell <srussell...@gmail.com>wrote: > On Fri, Aug 17, 2012 at 11:03 AM, crocboy25 <icestor...@hotmail.com> > wrote: > > Hello Group, > > > > I am selecting rows from an excel spreadsheet. In the spreadsheet I have > > like 2000+ rows, sometimes even more. When I run a spreadsheet it always > > stop reading the rows on line number 899. I have checked the data on the > > row, the row before and after and nothing seems out of the ordinary that > > would make it stop. Only 7 columns of small amounts of data per column. > Any > > idea why the reader would stop on a particular line and not move > forward? It > > doesnt error out but when I check data adapter after it executes it only > has > > like 895 records(the first 4-5 lines in excel are used as headers on my > > spreadsheets). I tried it with both an xls file and a xlsx file with the > > same results. Any idea what could be causing this? Thanks for any > > assistance. > > > > The string variable strConnection is set to ..... > > > > Provider= Microsoft.ACE.OLEDB.12.0;Data > > Source=c:\excel\upload\9907USS103402.XLSX; Extended Properties="Excel > > 12.0;HDR=NO;IMEX=1;"; > > > > Dim pobjDataAdapter As OleDbDataAdapter > > > > pobjDataAdapter = New OleDbDataAdapter("select * from LASPBS", > > strConnection) > ----------------------------- > > Is there a range on this workbook? > > -- > Stephen Russell > Sr. Analyst > Ring Container Technology > Oakland TN > > 901.246-0159 cell > > -- > You received this message because you are subscribed to the Google > Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML > Web Services,.NET Remoting" group. > To post to this group, send email to dotnetdevelopment@googlegroups.com > To unsubscribe from this group, send email to > dotnetdevelopment+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en > or visit the group website at http://megasolutions.net > -- You received this message because you are subscribed to the Google Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting" group. To post to this group, send email to dotnetdevelopment@googlegroups.com To unsubscribe from this group, send email to dotnetdevelopment+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en or visit the group website at http://megasolutions.net