TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Gaurav Arora
NA
14
1.4k
External table is not in the expected format
Aug 28 2019 9:17 AM
I have around 10 excel file in a directory and based on the date I am trying to sort and compare 2 files at a time using foreach loop using
C# console application in Visual Studio 2019.
Below is the code:
string
path = Directory.GetCurrentDirectory();
string
finalFile = path + FileName;
string
connString = @
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
+ finalFile +
";Extended Properties=\"Excel 12.0 Xml;HDR=YES;\""
;
OleDbConnection conn =
new
OleDbConnection(connString);
if
(conn.State == ConnectionState.Closed)
conn.Open();
DataTable dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
null
);
foreach
(DataRow roww
in
dtEmployeeDetails.Rows)
{
string
query =
"text query"
;
OleDbCommand cmd =
new
OleDbCommand(query, conn);
int
dr = cmd.ExecuteNonQuery();
}
conn.Close();
conn.Dispose();
I am sometime successfully able to execute the code, but sometime i get the error as "External table is not in the expected format".
Reply
Answers (
1
)
.ics file attachment is missing in google mail
different types of validations