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
Durga Velusamy
NA
318
114.1k
how to update datatable into sql table using c#
Nov 2 2016 1:54 AM
DataRow dr = dt.Rows.Find(new object[] { custm_id });
if (dr == null)
{
// dt.Rows.Add(dr);
dr = dt.NewRow();
val=true;
dr["custmid"] = custm_id;
}
else
{
dr.BeginEdit();
}
dr["fieldname"] = "test";
if (val)
{
dt.Rows.Add(dr);
}
else
{
dr.EndEdit();
}
like this i have edited table.
changes affected in datatable
SqlDataAdapter adapter;
using (adapter = new SqlDataAdapter("SELECT fieldname FROM customlist", con))
using (new SqlCommandBuilder(adapter))
{
adapter.Update(dt);
}
when i try to update
its updatating only new row. not updating edited rows into sql table.
how is possible any one help
Reply
Answers (
2
)
Write c# code that auto add stored procedure at run time
How to Convert .dbproj to .sqlproj programmatically using C#