I found that if I remove the EndEdit() statement, the function works as expected.  Sure don't understand why :)

Marv


 public void UpdateLastViewed(DateTime newDate)
{
                MOVIESDataSetTableAdapters
                .MOVIESTableAdapter mta = new Movies.MOVIESDataSetTableAdapters.MOVIESTableAdapter();
                MOVIESDataSet.MOVIESDataTable mdt = new MOVIESDataSet.MOVIESDataTable ();
                mta.FillByRID(mdt,RID);
                foreach (MOVIESDataSet.MOVIESRow row in mdt)
                {
                    if (row.Code == Code)
                    {
                        row.BeginEdit();
                        row.LAST_VIEWED = newDate;
=>=>=>      Remove this line   row.EndEdit();
                        break;
                    }
                }
                mta.Update ((MOVIESDataSet.MOVIESDataTable)mdt);
                mta.Dispose();
                mdt.Dispose();
                this.LastViewed = newDate;
            }


On 4/16/06, Marvin Cook <[EMAIL PROTECTED]> wrote:
Visual Studio 2005 :  C# :  Firebird-2.0.0.12484-0-Win32.exe : FirebirdClient-2.0-RC2.exe

I have the following procedure which compiles OK but throws an exception when run

 public void UpdateLastViewed(DateTime newDate)
            {
                MOVIESDataSetTableAdapters.MOVIESTableAdapter mta = new Movies.MOVIESDataSetTableAdapters.MOVIESTableAdapter();
                MOVIESDataSet.MOVIESDataTable mdt = new MOVIESDataSet.MOVIESDataTable ();
                mta.FillByRID(mdt,RID);
                foreach (MOVIESDataSet.MOVIESRow row in mdt)
                {
                    if (row.Code == Code)
                    {
                        row.BeginEdit();
                        row.LAST_VIEWED = newDate;
                        row.EndEdit();
                        break;
                    }
                }
                mta.Update ((MOVIESDataSet.MOVIESDataTable)mdt);
                mta.Dispose();
                mdt.Dispose();
                this.LastViewed = newDate;
            }
          

The exception reads "Update requires a valid UpdateCommand when passed DataRow collection with modified rows."

I am sure it is something I am doing wrong -- I just don't know what :)

TIA
Marv

Reply via email to