Group: StrataFrame Users
Posts: 322,
Visits: 529
|
Hi all. This one has me baffled. I have a BO based on a view because the table in SQL server (Sleep.AccountMaster) has fields in it that contain spaces and the BO Mapper pukes on them. I am updating it from the view via stored procedure. Here is my stored procedure: ALTER PROCEDURE [dbo].[prcUpdPatient] @Phone VARCHAR(50), @Status VARCHAR(50), @EmailAddress VARCHAR(50), @NextCalldate DATE, @CStateProviderHold BIT, @CStateReturnedEquipment BIT, @CustomerPatientID VARCHAR(50)
AS
BEGIN TRY
DECLARE @RetVal INT
/* Update the record */
UPDATE Sleep.AccountMaster SET Status = @Status,
[Email Address] = @EmailAddress,
[Next Call Date] = @NextCalldate,
CStateProviderHold = @CStateProviderHold,
CStateReturnedEquipment = @CStateReturnedEquipment
WHERE CustomerPatientID = @CustomerPatientID
SET @RetVal = @CustomerPatientID
END TRY
BEGIN CATCH
/* Get the details of the error*/
EXEC prcLogError
SET @RetVal = -1
END CATCH
IF @RetVal < 0
BEGIN
DECLARE @ErrText VARCHAR(1000)
SET @ErrText = 'Unable to Update the ' + @CustomerPatientID + ' Account Master Rcord'
RAISERROR( @ErrText, 16, 1 )
END
RETURN @RetValNow, the goofy thing is that if I run this update statement directly in a query window:update Sleep.AccountMaster
set Phone='7086367918',
Status='manual',
[Email Address]='marcia@tightlinecomputers.com',
[Next Call Date]='2011-03-06',
CStateProviderHold=1,
CStateReturnedEquipment=1
where CustomerPatientID='53-57933'
The update happens with no errors at all.
Could the problem be caused by the fact that the table AccountMaster belongs to the Sleep schema but the SP and the view belong to dbo?
Here are the error details. Hopefully someone can help me figure this one out.
BusinessLayerException An error occurred while saving an the data to the server. DataLayerSavingException Unable to Update the 53-57933 Account Master Rcord SqlException Unable to Update the 53-57933 Account Master Rcord
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.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.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at MicroFour.StrataFrame.Data.DbDataSourceItem.InternalExecuteNonQuery(DbCommand Command, Boolean IsTransactional, String TransactionKey) 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.Data.DataLayer.UpdateDataTable(DataTable TableToUpdate, Boolean Transactional, String TransactionKey) at MicroFour.StrataFrame.Data.DataLayer.SaveByForm(DataTable TableToSave, Boolean Transactional, String TransactionKey) at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey) at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save(Boolean Transactional, String TransactionKey) at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save() at MicroFour.StrataFrame.UI.Windows.Forms.MaintenanceFormToolStrip.cmdSave_Click(Object sender, EventArgs e) at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ToolStrip.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)
TIA
Marcia
|