Dynamicweb 8 Documentation
Save(DataRow) Method
Example 

The DataRow.
Saves the specified row.
Syntax
'Declaration
 
Public Overloads Sub Save( _ 
   ByVal DataRow As DataRow _ 
) 
public void Save( 
   DataRow DataRow 
)

Parameters

DataRow
The DataRow.
Example
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();
   }
}
Requirements

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

See Also

Reference

OrderLine Class
OrderLine Members
Overload List

Send Feedback