Dynamicweb.eCommerce.Orders Namespace > OrderLine Class > Save Method : Save(DataRow) Method |
class MyPage : System.Web.UI.Page { public void SaveOrderLine(OrderLine orderLine) { IDbConnection objConn = Database.CreateConnection("Ecom.mdb"); System.Data.IDbCommand objCommand = objConn.CreateCommand(); DataSet objDataset = new DataSet(); IDbDataAdapter objDataAdapter = Database.GetAdapter(); DataRow objRow = null; string SQL = "SELECT * FROM EcomOrderLines WHERE OrderLineID = '" + orderLine.ID + "' OR OrderLineParentLineID = '" + orderLine.ID + "'"; objCommand.CommandText = SQL; objDataAdapter.SelectCommand = objCommand; object objCommandBuilder = Database.GetCommandBuilder(objDataAdapter); objDataAdapter.Fill(objDataset); if (objDataset.Tables[0].Rows.Count > 0) { objRow = objDataset.Tables[0].Rows[0]; } else { objRow = objDataset.Tables[0].NewRow(); objDataset.Tables[0].Rows.Add(objRow); orderLine.ID = NumberGenerator.GetNumber("OL"); } orderLine.Save(objRow); objDataAdapter.Update(objDataset); objDataset.Dispose(); objCommand.Dispose(); objConn.Close(); objConn.Dispose(); } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2