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
ahmed salah
NA
530
149.8k
How to create more sheet then return message box success
Jan 25 2017 10:43 AM
I work in visual studio 2015 using c# windows form
I create excel file 2007 using xlsx with more sheets but
i need to return messagebox success tell me that file created
So that how to return message box success that show after file excel created ?
mycode
public
void
CreateSheetIfNotExistsmemberAR()
{
using
(System.Data.OleDb.OleDbConnection databaseConnection =
new
System.Data.OleDb.OleDbConnection())
{
DataTable schemaTable =
default
(DataTable);
var fileName =
string
.Format(
"{0}\\Book3105"
, Directory.GetCurrentDirectory());
var connection =
string
.Format(
"Provider=Microsoft.ACE.OLEDB.12.0;"
+
"Data Source={0};Mode=ReadWrite;Extended Properties=Excel 12.0 Xml;"
, fileName);
databaseConnection.ConnectionString = connection;
databaseConnection.Open();
schemaTable = databaseConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables,
new
object
[] {
null
,
null
,
"Sheet3$"
});
if
(schemaTable.Rows.Count == 0)
{
string
SQLDDLCommand =
"CREATE TABLE [Sheet3] (MemberID INTEGER, MemberName NCHAR(255))"
;
System.Data.OleDb.OleDbCommand excelCommand =
new
System.Data.OleDb.OleDbCommand(SQLDDLCommand, databaseConnection);
excelCommand.ExecuteNonQuery();
}
databaseConnection.Close();
}
}
Reply
Answers (
1
)
C# Connect to SQL server using differnt window credential
if file exist open new form problem