Want to build the ChatGPT based Apps? Start here
Become a member
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
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Dinesh Santhalingam
1.4k
737
328.9k
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