Algo Rhythm

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");
};
}

Answers (1)