vedran

vedran

  • NA
  • 16
  • 0

Updating SQLCE table - C#

Jun 8 2010 5:40 AM
Hello,

Please, I spend a lot of time, and still cant figure out this simple task. I need to update a row in a table. Table (members) has following structure:
id = int
phone = varchar
name = varchar

I have a method that takes values from a form. This is the method.

  public void doupdate(string phone, string name, int id)
{
SqlCeCommand DAUpdateCmd;
DataSet ds = new DataSet();

SqlCeConnection con = new SqlCeConnection(@"Data Source=C:\\users.sdf");

con.Open();
SqlCeDataAdapter da = new SqlCeDataAdapter("SELECT * from members ORDER BY id", con);

DAUpdateCmd = new SqlCeCommand("INSERT INTO members(phone, name) VALUES(@phone,@name) WHERE id = 'id', con");
da.UpdateCommand = DAUpdateCmd;

da.Fill(ds, "members");

da.Update(ds, "members");

con.Close();

After I call that method, nothing happens. No error and no update... This is driving me crazy.

I really tried lots of combination, and now I am totally brainless... everything is mixed in my head now.



Answers (1)