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

  • SEARCH
  • Home
  • 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 8369197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:35:11+00:00 2026-06-09T13:35:11+00:00

Here users browse to the Excel file from there system and then data is

  • 0

Here users browse to the Excel file from there system and then data is uploaded to sql database table.

I get this Error in Following Code : The Microsoft Jet database engine could not find the object ‘C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Student Registration1.xls’. Make sure the object exists and that you spell its name and the path name correctly.

I have no idea why it is asking for this Path ? C:\Program
Files\Microsoft Visual Studio 9.0\Common7\IDE\

protected void import_xls_Click(object sender, EventArgs e)
    {
        try
        {
            if (xmlupload.HasFile)
            {
                string path = xmlupload.PostedFile.FileName;


                string excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";

                OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
                excelConnection.Open();

                OleDbCommand cmd = new OleDbCommand("select * from [Sheet2$]", excelConnection);                    
                OleDbDataReader dReader = cmd.ExecuteReader();

                SqlBulkCopy sqlBulk = new SqlBulkCopy(SqlConnectionstring.mainConnectionString, SqlBulkCopyOptions.KeepIdentity);

                sqlBulk.DestinationTableName = "dbo.studentA";                    
                sqlBulk.ColumnMappings.Add("UserName", "UserName");
                sqlBulk.ColumnMappings.Add("Password", "Password");
                sqlBulk.ColumnMappings.Add("Name", "Name");
                sqlBulk.ColumnMappings.Add("Standard", "Standard");
                sqlBulk.ColumnMappings.Add("Division", "Division");
                sqlBulk.ColumnMappings.Add("SchoolName", "SchoolName");
                sqlBulk.ColumnMappings.Add("Language", "Language");
                sqlBulk.ColumnMappings.Add("ExamStatus", "ExamStatus");
                sqlBulk.ColumnMappings.Add("Result", "Result");                   

                sqlBulk.WriteToServer(dReader);

                lblmsg.Visible = true;
                lblmsg.Text = "Your data uploaded successfully";
                excelConnection.Close();
            }
        }
        catch (Exception ex)
        {
            lblmsg.Visible = true;
            lblmsg.Text = ex.Message.ToString();

        }

SqlConnectionstring.cs :

public class SqlConnectionstring
{
public SqlConnectionstring()
{
    //
    // TODO: Add constructor logic here
    //
}


public static readonly string mainConnectionString = ConfigurationManager.ConnectionStrings["constring"].ToString();
}
  • 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-09T13:35:12+00:00Added an answer on June 9, 2026 at 1:35 pm

    I will try to save the file in a working directory and then try to open from there.
    If the fileName has no path then the connection could find the file only if it is in the
    current directory (Usually where your program start)

    string savePath = @"c:\temp\uploads";
    
    if (xmlupload.HasFile)
    {
      string fileName = xmlupload.FileName;
      savePath = Path.Combine(savePath, fileName);
      xmlupload.SaveAs(savePath);
      string excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + 
                          savePath + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";   
    
      ....
    

    On a web server, to avoid permission problems, it is better to keep the file in a subfolder of the root folder of your site.

    In this case the folder could be fully qualified using the HttpServerUtility.MapMath method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Uploadify jQuery plugin for file upload.Here there is no browse button
Here is a snippet from a Sinatra app where users will be submitting urls.
Here is the object and global namespace for my Javascript code. Users.Cache.data = {
I have the table users and scores . Here are the associations: belongs_to :user
I have data from an Excel spreadsheet that I want to import into a
I have a table Items which stores fetched book data from Amazon. This Amazon
I have the following function that is pulling data from a database. The ajax
I've got 3 tables that are something like this (simplified here ofc): users user_id
Here are my models: **Resource** has_many :users, :through => :kits has_many :kits **User** has_many
Here are the list of methods for selecting users by different parameters. For example

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.