An ORM framework may be overkill for simpler requirements. There are
also 'lighter' ORM frameworks than EF, although EF is tightly integrated
into Visual Studio. If you just wanted to update a table (Visual FoxPro
in this case but the same applies to any back end) you could do
something like below. Note use of parameters. Names changed to protect
the innocent.

         class CustomerDocketWriter : AccountsSoftwareWriterAbstract
        {
            public Boolean DoProcessDocket(CustomerDocket updateDocket,
            SeqcoCompany thisCompany, DateTime stampDate)
            {
                UpdateOK = true;
                AccountsSoftwareConnection.ConnectionString =
                thisCompany.DataConnectionString;
                CommandString = @"update swimsinv where id=? set
                uploaded=.t., upwhen = ?";
                AccountsSoftwareCommand.CommandText = CommandString;
                AccountsSoftwareCommand.Connection =
                AccountsSoftwareConnection;
                AccountsSoftwareConnection.Open();
                AccountsSoftwareCommand.Parameters.Clear();
                OleDbTransaction AccountsSoftwareTxn =
                AccountsSoftwareConnection.BeginTransaction();
                AccountsSoftwareCommand.Transaction =
                AccountsSoftwareTxn;
                AccountsSoftwareCommand.Parameters.Add("@lnId",
                OleDbType.Integer);
                AccountsSoftwareCommand.Parameters.Add("@ltStamp",
                OleDbType.DBTimeStamp);
                AccountsSoftwareCommand.Parameters["@lnId"].Value =
                updateDocket.id;
                AccountsSoftwareCommand.Parameters["@ltStamp"].Value =
                stampDate;

                // -- Attempt to execute.
                try
                {
                    AccountsSoftwareCommand.ExecuteNonQuery();
                }
                catch (OleDbException ex)
                {
                    UpdateError = ex.Message;
                    UpdateOK = false;
                }

                // -- Did it work ?
                if (UpdateOK == true)
                {
                    // -- Then try to commit.
                    try
                    {
                        AccountsSoftwareTxn.Commit();
                    }
                    catch (Exception ex)
                    {
                        if (AccountsSoftwareWriterLogger.IsErrorEnabled)
                            AccountsSoftwareWriterLogger.Error("Error
                            committing SWIMSINV update to
                            AccountsSoftware:" + ex.Message);

                        AccountsSoftwareTxn.Rollback();
                    }
                }
                else
                    AccountsSoftwareTxn.Rollback();


                AccountsSoftwareConnection.Close();

                return UpdateOK;

            }

-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to