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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:47:14+00:00 2026-05-29T17:47:14+00:00

I have a Application on which i’m uploading a Excel File and displaying the

  • 0

I have a Application on which i’m uploading a Excel File and displaying the data inside a GridView.
My problems is now that, When I’m uploading the File gets uploaded. If the Data contains a MIX of Intergers and Text data, Text data’s are not shown inside the Gridview and the DataSet on which im loading it.

public DataTable GetExcelData(string _FileName)
{
    DataSet ds = new DataSet();

    string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _FileName + ";Extended Properties=Excel 8.0;";

    OleDbConnection connection = new OleDbConnection(connectionString);
    connection.Open();

    string sheetname = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null).Rows[0]["table_name"].ToString();
    try
    {
        OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM [" + sheetname + "]", connection);
        adapter.Fill(ds);
        connection.Close();
        return ds.Tables[0]; ;
    }
    catch (Exception ex)
    {
        try
        {
            if (connection.State == ConnectionState.Open)
                connection.Close();
        }
        catch (Exception) { }

        throw ex;
    }
}

This is code from which i’m loading the data onto the DataSet.

Ill show you an Example data


Column1

  1. 1234
  2. 2345
  3. 4567
  4. T123
  5. 123Q
  6. 6789

If we upload an Excel sheet with the Data Above it will only display it like this..


Column1

  1. 1234
  2. 2345
  3. 4567
  4. .
  5. .
  6. 6789

You can see in the Above T123,123Q is missing(it will be BLANK data). This is the Problem with my application when i’m Uploading an Excel sheet.

Has anyone come across a situation like this? Is there any way we can resolve 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-29T17:47:15+00:00Added an answer on May 29, 2026 at 5:47 pm

    Try this connection string… Its work fine now

    This connection string is define by use its work for XLS

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

    For XLSX

    string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + _FileName +";Extended Properties='Excel 12.0;HDR=YES;'"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which extracts data from an XML file using XPath. If
I have application which exports data in csv file which is stored in Document's
I have one application which uses the standard .NET forms authentication cookie, now I
I have an application which generates PDFs. Now I'm using Apache FOP just for
I have an application which reads in gridded coordinate data with values (i.e. lat,
I have an application which is used to modify content of a pdf file.
I have an application which uses a web service to get data. Before getting
I have application which use JNA and gets the audio and video. It works
I have Winform application,which does some operation in loops (file access, copy file, ....).
i have an application which gets random session timeouts. (IIS 7.5 on Windows 2008

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.