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 7773525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:09:08+00:00 2026-06-01T17:09:08+00:00

I was create a page to upload data from excel to data base its

  • 0

I was create a page to upload data from excel to data base its work fine in local system Not in server. Please help me to fix this error.. This is my partial code..

      if ((FileUpload1.PostedFile != null) && (FileUpload1.PostedFile.ContentLength > 0))
        {
            path = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
            SaveLocation = Server.MapPath("~/Temp") + "\\" + path;
            path = "Temp/" + path;
            FileUpload1.PostedFile.SaveAs(SaveLocation);

            //Import from Excel to database
            System.Data.OleDb.OleDbDataAdapter MyCommand = default(System.Data.OleDb.OleDbDataAdapter);
            System.Data.OleDb.OleDbConnection MyConnection = default(System.Data.OleDb.OleDbConnection);
            MyConnection = new System.Data.OleDb.OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0; " + "data source=" + SaveLocation + "; " + "Extended Properties=Excel 12.0;");
            MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection);
            DS = new System.Data.DataSet();
            MyCommand.Fill(DS);
            DataTable dt = DS.Tables[0];
            if (DS == null)
            {
                lblstatus.Text = "Problem occurred during uploading process... ";
            }
            else
            {
                foreach (DataRow row in dt.Rows)
                {
                    DataSet5TableAdapters.sp_import_emp_generalTableAdapter TA = new DataSet5TableAdapters.sp_import_emp_generalTableAdapter();
                    TA.GetData(Convert.ToString(row["fldempid"]), Convert.ToString(row["fldlastname"]), Convert.ToString(row["fldfirstname"]), Convert.ToString(row["fldnickname"]),
                        Convert.ToString(row["fldDOB"]), Convert.ToString(row["fldmarital"]), Convert.ToString(row["fldgender"]), Convert.ToString(row["fldsmoker"]),
                        Convert.ToString(row["fldpic"]), Convert.ToString(row["fldaddress1"]), Convert.ToString(row["fldaddress2"]), Convert.ToString(row["fldcity"]),

                        Convert.ToString(row["fldstate"]), Convert.ToString(row["fldmobile"]), Convert.ToString(row["fldtele"]), Convert.ToString(row["fldwemail"]),
                        Convert.ToString(row["fldoemail"]), Convert.ToString(row["fldzip"]), Convert.ToString(row["fldtitle"]), Convert.ToString(row["fldjoindate"]),
                        Convert.ToString(row["fldspecification"]), Convert.ToString(row["fldcompany"]), Convert.ToString(row["fldgroup"]), Convert.ToString(row["flddept"]),
                        Convert.ToDouble(row["fldCTC"]), Convert.ToDouble(row["flddiv"]), Convert.ToDouble(row["fldbasic"]), Convert.ToDouble(row["fldhra"]),
                        Convert.ToDouble(row["fldconveyance"]), Convert.ToDouble(row["fldPF"]), Convert.ToDouble(row["fldesi"]), Convert.ToDouble(row["fldPT"]),

                        Convert.ToDouble(row["fldTDS"]), Convert.ToString(row["fldcafeteria"]), Convert.ToDouble(row["fldbasicvalue"]), Convert.ToDouble(row["fldhravalue"]),
                        Convert.ToDouble(row["fldconvalue"]), Convert.ToDouble(row["fldpfvalue"]), Convert.ToDouble(row["fldesivalue"]), Convert.ToDouble(row["fldptvalue"]),
                        Convert.ToDouble(row["fldtdsvalue"]), Convert.ToDouble(row["fldGrosspay"]), Convert.ToDouble(row["fldgrossearn"]), Convert.ToDouble(row["fldtotaldeduction"]),
                        Convert.ToDouble(row["fldnetpay"]), Convert.ToString(row["fldaccount"]), Convert.ToString(row["fldemployer"]), Convert.ToString(row["fldjobtitle"]),
                        Convert.ToString(row["fldstart"]), Convert.ToString(row["fldend"]), Convert.ToString(row["fldtotalexp"]), Convert.ToString(row["fldcomment"]),
                        Convert.ToString(row["fldedu"]), Convert.ToString(row["fldmajor"]), Convert.ToInt32(row["fldpassedout"]), Convert.ToString(row["fldskill"]),
                        Convert.ToString(row["fldexp"]), Convert.ToString(row["fldcomments"]), Convert.ToString(row["fldlanguage"]), Convert.ToString(row["fldfluency"]),
                        Convert.ToString(row["fldstatus"]));

                }

                System.Threading.Thread.Sleep(5000);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "onload", "<script language='javascript'>alert('Data Updated Successfully...');</script>", false);
                lblstatus.Text = "Data updated successfully..";
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "onload", "<script language='javascript'>alert('Please select a file to upload');</script>", false);

        }

    }
    catch (Exception e1)
    {
        ScriptManager.RegisterStartupScript(this, this.GetType(), "onload", "<script language='javascript'>alert('" + e1.Message + "');</script>", false);
    }    

Please help me to fix this error….

  • 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-01T17:09:09+00:00Added an answer on June 1, 2026 at 5:09 pm

    If data is being added to the local database there is no point in checking your above code. There must be a problem with your server database connection or a permission issue as you are uploading the Excel file.

    Make sure you have permissions for the folder where you are uploading the file:

    SaveLocation = Server.MapPath("~/Temp") + "\\" + path;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a please confirm page before submitting the data from
I am using PHPExcel to create an Excel document, using data from a MySQL
I need to create a page that will load divs from an external page
I wanted to create a page with a simple button which runs away from
I need to create a page that will automatically create a thumbnail from all
how can i create a jQuery multiple image upload(upload without refresh page after choose
I have set permission to allow anonymous user to create page. but when the
I create a page and some parts of it are layout files that are
I want to create settings page for my android application.In the settings page is
How to create web page using CSS and div to create 4 split screen?

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.