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
R.D Ip
NA
76
8.3k
column name 'nwt wt' already belongs to this datatable error
Apr 30 2021 11:21 AM
I am working on c#
I am saving a excel sheet
but I am facing an error
but my requirement is same column name in multiple time in excelsheet
below is my original requirement
what i am doing:
datatable data assign to the column
see below code:
private
void
AddStatExcelSheet(DataTable pDT, ExcelWorksheet excelWorksheet)
{
DataTable dtCust =
new
DataTable();
dtCust.Columns.Add(
"Net Wt"
,
typeof
(
double
));
dtCust.Columns.Add(
"sx"
,
typeof
(
int
));
dtCust.Columns.Add(
"sd"
,
typeof
(
double
));
dtCust.Columns.Add(
"Net Wt"
,
typeof
(
double
));
dtCust.Columns.Add(
"sx"
,
typeof
(
int
));
dtCust.Columns.Add(
"sd"
,
typeof
(
double
));
DataTable dt = dr.CopyToDataTable();
foreach
(DataRow Drow
in
dt.Rows)
{
DataRow DRowDetailSubDet = dtCust.NewRow();
dtCust[
"Net Wt"
] = Drow[
"snweight"
];
dtCust[
"sx"
] = Drow[
"sqty"
];
dtCust[
"sd"
] = Drow[
"sdweight"
];
dtCust[
"Net Wt"
] = Drow[
"fnetwt"
];
dtCust[
"sx"
] = Drow[
"fsx"
];
dtCust[
"sd"
] = Drow[
"fsd"
];
dtCust.Rows.Add(DRowDetailSubDet);
}
}
I am trying to add bxc status and fx status but how?
please help
Reply
Answers (
4
)
View Page Into Pdf Convert in dot net MVC Core 3.1
Argument list using IList in C# asp.net mvc