importing excel sheet into datagrid
-
hi all, In my application vb.net 2003 and ASP.net i have to import excel sheet into sql server 2003 existing table n then into datagrid. I have used this code but throwing an error "System.Data.OleDb.OleDbException: The Microsoft Jet database engine could not find the object. Make sure the object exists and that you spell its name and the path name correctly." Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Team wise EMP Profile.xls") + ";Extended Properties=Excel 8.0;" Dim objconn As New OleDbConnection(connstr) Dim ds As New DataSet Dim objadapter As New OleDbDataAdapter("SELECT * FROM Emp_Profile_Tbl", objconn) Try objconn.Open() objadapter.Fill(ds, "nomi") dg.DataSource = ds.Tables(0).DefaultView dg.DataBind() Finally objconn.Close() End Try pls help me
-
hi all, In my application vb.net 2003 and ASP.net i have to import excel sheet into sql server 2003 existing table n then into datagrid. I have used this code but throwing an error "System.Data.OleDb.OleDbException: The Microsoft Jet database engine could not find the object. Make sure the object exists and that you spell its name and the path name correctly." Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Team wise EMP Profile.xls") + ";Extended Properties=Excel 8.0;" Dim objconn As New OleDbConnection(connstr) Dim ds As New DataSet Dim objadapter As New OleDbDataAdapter("SELECT * FROM Emp_Profile_Tbl", objconn) Try objconn.Open() objadapter.Fill(ds, "nomi") dg.DataSource = ds.Tables(0).DefaultView dg.DataBind() Finally objconn.Close() End Try pls help me
sivaram praveen wrote:
Server.MapPath("Team wise EMP Profile.xls")
the path of xls file or file name might be wrong..
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)