Editing Database Table From Windows App
Can someone point me to some resources that explain how I can edit a database table on a server from a desktop application?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Algo RhythmPosted Feb 12, 2010, 3:56 PM
OK, I have this code in a web service. Trying to update from a client Windows app. Specifically, I need to get the setContacts method working so that it actually updates the table. Right now it does nothing.
[WebMethod]
public DataTable getContacts()
{
using (SqlConnection con = new SqlConnection(connString))
{
DataTable dt = new DataTable("Contacts");
SqlCommandBuilder cb = new SqlCommandBuilder(da);
da = new SqlDataAdapter("SELECT * FROM Contacts", con);
da.Fill(dt);
return dt;
};
}
[WebMethod]
public void setContacts(DataTable table)
{
using (SqlConnection con = new SqlConnection(connString))
{
DataTable dt = new DataTable("Contacts");
SqlCommandBuilder cb = new SqlCommandBuilder(da);
da = new SqlDataAdapter("SELECT * FROM Contacts", con);
da.Fill(dt);
da.Update(table);
};
}
Lalit MPosted Feb 12, 2010, 12:42 PM
http://www.codeproject.com/KB/architecture/DataModifierFramework.aspx