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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:10:54+00:00 2026-05-30T16:10:54+00:00

So clients upload Excel files to us and we have a windows service that

  • 0

So clients upload Excel files to us and we have a windows service that periodically grabs new files and bulk-loads the contents to our SQL server like so:

string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePath + ";Extended Properties=\"Excel 12.0;HDR=YES;\"";

using (OleDbConnection excelConnection = new OleDbConnection(excelConnectionString))
{
  excelConnection.Open();
  OleDbCommand cmd;
  cmd = new OleDbCommand("Select " + fileID.ToString() + " as [FileID],[AccountName],[Author],[Title],[Body] from [Sheet1$] where [Body] is not null;", excelConnection);
  OleDbDataReader dReader;
  dReader = cmd.ExecuteReader();
  using (SqlBulkCopy sqlBulk = new SqlBulkCopy(ConfigurationManager.ConnectionStrings["VI.OpenAmplify.Properties.Settings.DBConnection"].ConnectionString))
  {
      sqlBulk.DestinationTableName = "Web_OpenAmp_Posts";
      sqlBulk.ColumnMappings.Add("FileID", "FileID");
      sqlBulk.ColumnMappings.Add("AccountName", "AccountName");
      sqlBulk.ColumnMappings.Add("Author", "Author");
      sqlBulk.ColumnMappings.Add("Title", "Title");
      sqlBulk.ColumnMappings.Add("Body", "Body");

      sqlBulk.WriteToServer(dReader);
  }
}

Works great most of the time, even if there are some blank rows at the bottom (the WHERE clause takes care of that). But sometimes we get these weird files with a lot (about a million) blank rows at the bottom and we get an Exception with Unknown as the message. If I remove the WHERE clause from OleDbCommand declaration, the file loads fine, but we get a million blank rows inserted as well. Any ideas on how to deal with this?

  • 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-05-30T16:10:56+00:00Added an answer on May 30, 2026 at 4:10 pm

    We had Microsoft Access Database Engine 2010 Redistributable drivers x_64 flavor installed on our 64-bit windows server. When compiling project to be run with such configuration, Platform Target for the project needs to be set to Any CPU. Somehow we had x86 selected by default (which works on dev machine). Changing this setting fixed the issue.

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

Sidebar

Related Questions

I have an application where we're having our clients upload a csv file to
I have a web application that allows a user to upload an Excel spreadsheet
I've got a simple WCF service that lets clients/consumers upload image, audio or video
I will have clients upload pdf files with sensitive information. I'm planning on having
If I upload files to my server and thus have clients/customers download these files.
Our clients upload a serious amount of data from all over the world and
I am very new to website design. Have an architect who wants his clients
I need to upload files to iDisk drive. I've found that iDisk has webdav
We are building an extranet sharepoint portal for our clients. Each client will have
I have an excel file that uses a web query to pull in data.

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.