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
sai kumar
NA
14
16.1k
How to map DataTable to DTO?
Oct 8 2016 6:21 AM
string connString = @
"server =.; database =appsword; uid = madhubaabu; pwd = Welcome@123; "
;
string query =
"SELECT distinct TOP 5 ISNULL(C.Name, 'Others') AS 'Company',A.Name AS 'Customers', O.Fee AS 'Amount' FROM ClientCursor.Opportunity AS O INNER JOIN Common.Company AS C ON C.Id = O.ServiceCompanyId INNER JOIN [ClientCursor].[Account] AS A ON A.Id = O.AccountId order by O.Fee DESC"
;
SqlConnection conn =
new
SqlConnection(connString);
conn.Open();
SqlCommand cmd =
new
SqlCommand(query, conn);
SqlDataAdapter da=
new
SqlDataAdapter(cmd);
DataSet ds =
new
DataSet();
//conn is opened by dataadapter
da.Fill(ds,
"newtbale"
);
return
ds;
I'm new to AutoMapper and have couple of questions regarding datatable to object mapping.I have sqlquery code and sql result like above.
I want to do object to object map with automapper, i.e,transfer datatable to Class object(viewmodel) by using ado.net. can anybody help on this!
Reply
Answers (
2
)
meaning of question mark in this instruction
how can create a module in C#.NET