>Protected Overrides Sub HookSetDefaultValues(ByVal dataRow As System.Data.DataRow) > Dim cmd As IDbCommand > > If Not (Me.DefaultValues Is Nothing) Then > ' Cast the DefaultValues object to the custom type > Dim Defaults As ContactDefaultValues = CType(Me.DefaultValues, > ContactDefaultValues) > > ' Store the default values in the new DataRow > dataRow("idEntityType") = Defaults.idEntityType > dataRow("idMaritalStatus") = Defaults.idMaritalStatus > > ' Go to the database to get the new contact's sRefNum > ' This way, the user knows the Ref Num before the contact is saved at all. > Dim param1 As IDbDataParameter = Me.CreateParameter("@idSeqType", 4) > Dim param2 As IDbDataParameter = Me.CreateParameter("@idContact", 1) > Dim param3 As IDbDataParameter = Me.CreateParameter("@sValue", "dogfood") > param3.Direction = ParameterDirection.Output > Dim params As IDbDataParameter() = {param1, param2, param3} > > Me.ExecSprocScalar("CalcSeqNum", cmd, params) > Dim paramOut As IDbDataParameter = CType(cmd.Parameters("@sValue"), > IDbDataParameter) > dataRow("sRefNum") = paramOut.Value.ToString > End If > > End Sub >>