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
Algo Rhythm
NA
41
0
Updating A Database From A Web Service
Feb 15 2010 11:25 AM
I have this code in a web service, but when I try to update the database using the second method (setContacts), it does not update at all, although I do not get an error message.
[
WebMethod
]
public
DataSet
getContacts()
{
using
(
SqlConnection
con =
new
SqlConnection
(connString))
{
DataSet
ds =
new
DataSet
(
"Contacts"
);
SqlCommandBuilder
cb =
new
SqlCommandBuilder
(da);
da =
new
SqlDataAdapter
(
"SELECT * FROM Contacts"
, con);
da.Fill(ds);
return
ds;
};
}
[
WebMethod
]
public
void
setContacts(
DataSet
data)
{
using
(
SqlConnection
con =
new
SqlConnection
(connString))
{
DataSet
ds =
new
DataSet
(
"Contacts"
);
SqlCommandBuilder
cb =
new
SqlCommandBuilder
(da);
da =
new
SqlDataAdapter
(
"SELECT * FROM Contacts"
, con);
da.Update(data,
"Contacts"
);
};
}
Reply
Answers (
1
)
c# resume parser
populating data into a treeview