Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Update Not Bounded Fields
Message
From
09/01/2003 12:09:38
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00739818
Message ID:
00739858
Views:
22
Yes, you can do that ... you must have some other problem that's preventing that column from updating. Actually, I've had problems using the EndCurrentEdit() and you might want to try using the DataRow's EndEdit() instead, like this:
public void EndTheEdit(DataSet ds)
{
  if (ds == null)
    return;

  for (int nTable = 0; nTable < ds.Tables.Count; nTable++)
  {
    for (int nRow = 0; nRow < ds.Tables[nTable].Rows.Count; nRow++)
    {
      if (ds.Tables[nTable].Rows[nRow].HasVersion(DataRowVersion.Proposed))
        ds.Tables[nTable].Rows[nRow].EndEdit();
    }
  }
}
~~Bonnie


>No, same problem.
>What I want to say, is it possible that I can update my DataSet using Databinding to some fields & Manual update to other fields (same time)?
>
>
>>OK, I don't use the CommandBuilder stuff (I roll my own), but I think your problem is that you should do the EndCurrentEdit() before you build the Insert command.
>>
>>~~Bonnie
>>
>>
>>>I am updating my DataSet using the DataRow, my case as follow:
>>>When I click "Add" button to add new record to the table all the files are binded so I need to type in the data in the txt files in my window form
>>>now, I have some flag fields not binded to any textbox in the form and must set a value to it manualy so I use this code:
>>>
>>>myDR("CompanyID") = strCompanyID
>>>myDA.InsertCommand = myCB.GetInsertCommand
>>>Me.BindingContext(myDS, "Company").EndCurrentEdit()
>>>myDA.Update(myDS, "Company")
>>>myDS.AcceptChanges()
>>>
>>>all the data saved because of the databinding except "CompanyID"
>>>
>>>any idea?
>>>
>>>
>>>>Ahmad,
>>>>
>>>>When you say "update", do you mean change the value of a column in a DataSet.Table or do you mean update the backend database table?
>>>>
>>>>First one, just set your column equal to whatever:
>>>>
>>>>ds.Tables[0].Rows["WhateverColumn"] = "Whatever"
>>>>
>>>>
>>>>Second one, when you update your backend database, any changed values in the DataSet will be sent to the backend.
>>>>
>>>>Hope this answers your question ...
>>>>
>>>>~~Bonnie
>>>>
>>>>>Hi All,
>>>>>
>>>>>Is there a way to update a column(s) in the table not binded, while other columns in the same table are binded?
>>>>>
>>>>>BR
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform