Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
I need to know are this connection string to excel is wrong or true

C#
public static  string  fileName = string.Format("{0}\\Book502", Directory.GetCurrentDirectory());

string connection = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source={0};Mode=ReadWrite;Extended Properties='Excel 12.0 Xml;HDR=YES'", fileName);


my file book 502
have two sheets

sheet 1

i insert data and update and read data from it

it have following column

ID INTEGER

User Name char(255)

Country char(255)

sheet 2 have following columns

ID INTEGER

Member Name char(255)

meaning all two sheets have text except ID

ALSO file have column in header

processes of two sheets insert update read select

size of transaction i will use 5000 rows

3 USER will use excel sheet

so that what correct format to excel file ?

the format i write working good ?
but really i need what i assign IMEX=0 or 1 or 2
HDR = YES OR NO


What I have tried:

How to create connection string to excel sheet 2007 by c#
Posted
Updated 27-Feb-17 23:17pm

Hello,

You can refer this link, i think it's helpful for you.

How to Read Microsoft Excel 2007 Using a Connection String in C#[^
 
Share this answer
 
 
Share this answer
 
Comments
ahmed_sa 28-Feb-17 5:32am    
from what i read my connection above is correct what is benfit from using imex
ahmed_sa 28-Feb-17 5:34am    
if i set in my connection IMEX=1 WHAT WHILL HAPPEN
Richard MacCutchan 28-Feb-17 6:08am    
It is explained in the article.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900