When using the Smart Objects Client API to 'create' an instance of a smart object, is there any way to get the 'autonumber' value that was generated as the key all in one call? I've tried to define the autonumber column as a return parameter or an output parameter, but it is always null. I'm not sure how the actual insert works under the covers, so I don't know if it even returns the generated id. Here is a code snippet:
SourceCode.Data.SmartObjectsClient.
SOCommand cmd = cnn.CreateCommand();cmd.CommandType =
CommandType.StoredProcedure;cmd.CommandText =
"[Work_Item.Create]";cmd.Parameters.Add(
new SourceCode.Data.SmartObjectsClient.SOParameter("Work Item Id",DbType.Int32,999,ParameterDirection.Output,true,"Work_Item_Id",DataRowVersion.Current,null)); // This is an auto-generated numbercmd.Parameters.Add(
new SourceCode.Data.SmartObjectsClient.SOParameter("Client_Services_Request_Id", 3254)); // one input parametercmd.ExecuteNonQuery();
System.Diagnostics.
Debug.Write(cmd.Parameters["Work Item Id"].Value); // Always null