Inserts a record into the database using the supplied CommandConfig
| C# | Visual Basic |
public long ExecuteInsert( CommandConfig CmdConfig )
Public Function ExecuteInsert ( _ CmdConfig As CommandConfig _ ) As Long
- CmdConfig (CommandConfig)
-
The parameterised insert statement/table name and parameter values
Returns the value assigned to the auto-incrementing (where applicable) column or -1
DbNetData Data = new DbNetData( ConfigurationSettings.AppSettings[ "nwind" ] ); Data.Open(); CommandConfig CmdConfig = new CommandConfig("products"); // You only need to specify the table name. DbNetData will build the rest of // the insert statement automatically using the parameters CmdConfig.Params["productname"] = ProductName.Value; CmdConfig.Params["categoryid"] = CategoryID.Value; CmdConfig.Params["description"] = ProductName.Description; CmdConfig.Params["discontinued"] = 0; long ProductID = Data.ExecuteInsert(CmdConfig) Data.Close();