ورود

View Full Version : سوال: دادن خطا درهنگام ریختن excel در table



r_khan
یک شنبه 25 تیر 1391, 23:46 عصر
سلام
برای ریختن excel در table و گریدویو از کد زیر استفاده کردم ولی خطا میده کد و خطا را میزارم


string connString = @"Provider = Microsoft.Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=Excel 8.0";

OleDbConnection oledbConn = newOleDbConnection(connString);
try
{
oledbConn.Open();
OleDbCommand cmd = newOleDbCommand("SELECT * FROM [Sheet1$]", oledbConn);
OleDbDataAdapter oleda = newOleDbDataAdapter();
oleda.SelectCommand = cmd;
DataSet ds = newDataSet();
oleda.Fill(ds, "Customer");
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
}
catch
{
}
finally
{

oledbConn.Close();
}

اینم خطا
The Microsoft Jet database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly.

TeacherMath
دوشنبه 26 تیر 1391, 12:38 عصر
http://www.ezzylearning.com/tutorial.aspx?tid=1553779

http://forums.asp.net/t/1375170.aspx

http://www.codeproject.com/Tips/311014/READ-EXCEL-IN-ASPNET