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
Dinesh Santhalingam
NA
737
368.6k
Bulk copy in Sql using C#
Jan 30 2017 1:16 AM
I have a data table .I want to push it to the sql table using Sqlbulkcopy .
Data table dt=new datatable();some data were loaded
Push this data to sql table.
string
connectionstring
= @"Data Source";
using (SqlConnection
destinationConnection
=
new
SqlConnection(connectionstring))
{
destinationConnection.Open();
using (SqlBulkCopy
bulkCopy
=
new
SqlBulkCopy(destinationConnection.ConnectionString))
{
bulkCopy.DestinationTableName
=
"studentmanagement"
;
bulkCopy.ColumnMappings.Add("Name", "Name");
bulkCopy.ColumnMappings.Add("Subjectname", "
Subjectname
");
bulkCopy.ColumnMappings.Add("Marks", "
Marks
");
bulkCopy.WriteToServer(dt);
}
destinationConnection.Close();
}
Error populating Cannot access the destination table.
Its not working.please anyone help me to solve this?
Reply
Answers (
9
)
How to integrate Aadhaar card with C# (VS 2012-2013)?
real time example