Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8708227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:04:33+00:00 2026-06-13T04:04:33+00:00

I do import the data from Excel sheet to Sql database..everything is fine,when i

  • 0

I do import the data from Excel sheet to Sql database..everything is fine,when i run this code,my access engine could not find mt sheet,it throws like this error..
my error is

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.

but i already checked with my designation folder,its correct..then i don’t know why it’s repeated

my C# code below..

public partial class _Default : System.Web.UI.Page 
{
    string constr = @"Data Source=VIS1-B12\SQLEXPRESS;Initial Catalog=Sql_Excel;Integrated Security=True providerName=System.Data.SqlClient" ;

    protected void btn_okClick(object sender, EventArgs e)
    {
        string path = Fup_Excel.PostedFile.FileName;
        string exconstr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+path+";Extended Properties=Excel 8.0";

        OleDbConnection excelcon = new OleDbConnection(exconstr);
        excelcon.Open();

        OleDbCommand cmd = new OleDbCommand("select * from [Sheet1$]", excelcon);
        OleDbDataReader dbreader;
        OleDbDataAdapter dap = new OleDbDataAdapter(cmd);
        DataSet ds = new DataSet();
        //dap.Fill(ds,"sheet1");
        dbreader = cmd.ExecuteReader();

        SqlBulkCopy bcpy = new SqlBulkCopy(constr);
        bcpy.DestinationTableName = "Excel_Details";
        bcpy.WriteToServer(dbreader);
        //GridView1.DataSource = ds.Tables[0].DefaultView;
        //GridView1.DataBind();
        excelcon.Close();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:04:34+00:00Added an answer on June 13, 2026 at 4:04 am

    It’s better you should retrieve excel sheet name using code.
    Code is shown below

    OleDbConnection con = new OleDbConnection(ConnString);
    OleDbCommand cmd = new OleDbCommand();
    cmd.CommandType = System.Data.CommandType.Text;
    cmd.Connection = con;
    OleDbDataAdapter dAdapter = new OleDbDataAdapter(cmd);
    DataTable dtExcelRecords = new DataTable();
    con.Open();
    DataTable dtExcelSheetName = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
    string getExcelSheetName = dtExcelSheetName.Rows[0]["Table_Name"].ToString();
    cmd.CommandText = "SELECT * FROM [" + getExcelSheetName + "]";
    dAdapter.SelectCommand = cmd;
    dAdapter.Fill(dtExcelRecords);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to import data from excel file (.xlsx) into sql database, my
How do I import data from a excel sheet onto a PGSQL database on
I'm using SSIS to import data from Excel sheets into SQL Server 2005, the
I have to import data from an Excel file to database and to do
I have to get the data in an Excel sheet into a Access database.
I need to import data from Excel to Sql Server using ASP.NET. How can
I'm using the NPOI Library to import some data from an excel sheet to
I want to insert data from excel sheet to datatable and this was working
i am preparing myself for importing data from excel sheet to sql server 2005.I
I need to import data from Excel into a SQL 2000 db. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.