Using Custom Fill Methods on BO


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Are you creating the stored procedure?  If so, what do your CRUD settings look like on your BO?  Last, what does the SP look like?

Note: Please do not post the entire SP text in the text window.  Upload it as an attachment so we can get a more accurate view.

Bradley Marston
Bradley Marston
StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)
Group: Forum Members
Posts: 24, Visits: 119
Taking the variable out of the SP does not change anything

the only way to make it work is to change the SP's that get the data and make sure reseller is not in the data returned.

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
OK, you can remove the @reseller field from the update command.  The business object will only attempt to update fields that are part of the mapped table (those contained in the AllFieldsList).  Since your business object was mapped to Customers, it does not think that @reseller should be supplied because it doesn't think it's part of the updating table.  So, whatever the structure of the data table inside the business object, it's only going to update the fields that are part of the mapped table on SQL Server.
Bradley Marston
Bradley Marston
StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)
Group: Forum Members
Posts: 24, Visits: 119
No I am just trying to do an update in the customers table

the Reseller field from the Select Was used by another apllication

CREATE PROCEDURE UDSP_Customers_GetData
 (  
  @Customer_UID uniqueidentifier = NULL
 Wink
AS

SET NOCOUNT ON

SELECT cs.*, rs.reseller
 FROM Customers cs JOIN
  Reseller rs ON cs.reseller_UID = rs.reseller_UID
 WHERE Customer_UID = @Customer_UID

_________________________________________________________________

CREATE PROCEDURE UDSP_Customers_Update

 @Customer_UID uniqueidentifier ,  
 @CustomerName varchar(50)      = NULL,
 @CustomerStreet varchar(50)    = NULL,
 @CustomerStreet2 varchar(50)    = NULL,
 @CustomerCity varchar(32)      = NULL,
 @CustomerState char(2)         = NULL,
 @CustomerZIP varchar(9)        = NULL,
 @LCon_Name varchar(50)         = NULL,
 @LCon_Phone varchar(20)        = NULL,
 @LCon_Ext varchar(4)           = NULL,
 @LCon_Mobile varchar(20)       = NULL,
 @LCon_Fax varchar(20)          = NULL,
 @LCon_EmailAddr varchar(80)    = NULL,
 @Status char(16)               = NULL,
 @DealerNum char(7)             = NULL,
 @ODNum char(7)                 = NULL,
 @OD2Num char(7)                = NULL,
 @UpdatedBy varchar(16)               ,  
 @CreatedBy varchar(16)         = NULL,
 @Updateddt datetime            = NULL,
 @Createddt datetime            = NULL,
 @Customer_UID_ORGPK uniqueidentifier = NULL,
 @Reseller_UID uniqueidentifier = NULL,
 @reseller varchar(16)         = NULL
)
AS

SET NOCOUNT ON

UPDATE customers SET   
  CustomerName    = ISNULL(@CustomerName, CustomerName),
  CustomerStreet  = ISNULL(@CustomerStreet, CustomerStreet),
  CustomerStreet2  = ISNULL(@CustomerStreet2, CustomerStreet2),
  CustomerCity    = ISNULL(@CustomerCity, CustomerCity),
  CustomerState   = ISNULL(@CustomerState, CustomerState),
  CustomerZIP     = ISNULL(@CustomerZIP, CustomerZIP),
  LCon_Name       = ISNULL(@LCon_Name, LCon_Name),
  LCon_Phone      = ISNULL(@LCon_Phone, LCon_Phone),
  LCon_Ext        = ISNULL(@LCon_Ext, LCon_Ext),
  LCon_Mobile     = ISNULL(@LCon_Mobile, LCon_Mobile),
  LCon_Fax        = ISNULL(@LCon_Fax, LCon_Fax),
  LCon_EmailAddr  = ISNULL(@LCon_EmailAddr, LCon_EmailAddr),
  Status          = ISNULL(@Status, Status),
  DealerNum       = ISNULL(@DealerNum, DealerNum),
  ODNum           = ISNULL(@ODNum, ODNum),
  OD2Num          = ISNULL(@OD2Num, OD2Num),   
  Reseller_UID    = ISNULL(@Reseller_UID, Reseller_UID),  
  UpdatedBy            = UpdatedBy, 
  UpdatedDt            = GETDATE()

 WHERE Customer_UID    = @Customer_UID

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Are you trying to update the Reseller.reseller field?  Or are you trying to just update the fields within the Customers table?
Bradley Marston
Bradley Marston
StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)
Group: Forum Members
Posts: 24, Visits: 119
here are the fileshopfully you will find something.
Attachments
debug.JPG (114 views, 208.00 KB)
BOCust.zip (102 views, 6.00 KB)
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The image of the debug file that you posted is a little too small to be legible.  Could you zip it and the partial class for your business object and post them here?

Don't post it here if there's a password in the connection string... email it to me through the forum.

Bradley Marston
Bradley Marston
StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)
Group: Forum Members
Posts: 24, Visits: 119

Sorry "No the AllFieldsList property  does bot show it as a property"

Should have said that reselller is not a member of AllFieldsList .

The  AllFieldsList  has 22 memebers of which reselller is not one.

There are 24 variables in  the stored proc @Customer_UID_ORGPK  and   @reseller  are added for strataframe

 

CREATE PROCEDURE UDSP_Customers_Update

 @Customer_UID uniqueidentifier ,  
 @CustomerName varchar(50)      = NULL,
 @CustomerStreet varchar(50)    = NULL,
 @CustomerStreet2 varchar(50)    = NULL,
 @CustomerCity varchar(32)      = NULL,
 @CustomerState char(2)         = NULL,
 @CustomerZIP varchar(9)        = NULL,
 @LCon_Name varchar(50)         = NULL,
 @LCon_Phone varchar(20)        = NULL,
 @LCon_Ext varchar(4)           = NULL,
 @LCon_Mobile varchar(20)       = NULL,
 @LCon_Fax varchar(20)          = NULL,
 @LCon_EmailAddr varchar(80)    = NULL,
 @Status char(16)               = NULL,
 @DealerNum char(7)             = NULL,
 @ODNum char(7)                 = NULL,
 @OD2Num char(7)                = NULL,
 @UpdatedBy varchar(16)               ,  
 @CreatedBy varchar(16)         = NULL,
 @Updateddt datetime            = NULL,
 @Createddt datetime            = NULL,
 @Customer_UID_ORGPK uniqueidentifier = NULL,
 @Reseller_UID uniqueidentifier = NULL,
 -- bellow added for sf
 @reseller varchar(16)         = NULL
)
AS

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The AllFieldsList is a property on the BusinessLayer class, so, if you put a breakpoint within one of your methods on your business object, you can test the AllFieldsList property to see if it contains "reseller".  When the DAL builds the UPDATE query for a business object, it iterates through the columns on the business object and adds them to the update command only if the column is included in the AllFieldsList of the business object.

The next release also contains some additional functionality for the business objects to allow them to exclude fields from updates.  The feature is currently in testing by a few of our users and will be included in the next release.

Bradley Marston
Bradley Marston
StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)StrataFrame Novice (58 reputation)
Group: Forum Members
Posts: 24, Visits: 119
No the AllFieldsList property  does bot show it as a property

Hete is my select statement form sql server Sp

SELECT cs.*, rs.reseller
 FROM Customers cs JOIN
  Reseller rs ON cs.reseller_UID = rs.reseller_UID
 WHERE Customer_UID = @Customer_UID

If I remove  ",rs.reseller"  Then the save works in edit mode (still do not know why add works)

here is the error dump

DataLayerSavingException
 Invalid column name 'reseller'.
SqlException
 Invalid column name 'reseller'.

Source     : MicroFour StrataFrame Business

Stack Trace:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack)
   at MicroFour.StrataFrame.Data.SqlDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack)
   at MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(QueryInformation QueryInfo, OnChangeEventHandler CallBack)
   at MicroFour.StrataFrame.Data.DataLayer.GetRowFromServer(DataRow LocalRow)
   at MicroFour.StrataFrame.Data.DataLayer.HandleConcurrencyException(DataRow LocalRow)
   at MicroFour.StrataFrame.Data.SqlDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler, Boolean RecreateCommand)
   at MicroFour.StrataFrame.Data.DbDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler)
   at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)
   at MicroFour.StrataFrame.Business.BusinessLayer.Save(Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.Business.BusinessLayer.Save()
   at ASTSWITCHTEST.Form1.button7_Click(Object sender, EventArgs e) in C:\strataframetest\ASTSWITCH\ASTSWITCHTEST\ASTSWITCHTEST\Form1.cs:line 93
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

below is the output from

MicroFour.StrataFrame.Data.DataBasics.DataSources["cnDB"].SetDebugOn("C:\\Debug.html", true);


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search