﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » DataLayer exception has me stumped</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sat, 02 May 2026 12:38:25 GMT</lastBuildDate><ttl>20</ttl><item><title>DataLayer exception has me stumped</title><link>http://forum.strataframe.net/FindPost11770.aspx</link><description>I'm getting the following exception when I save a new record.  The record is saved fine, but apparently there is an error when the data layer goes to refresh the data.  What might be causing this?&lt;br&gt;
&lt;br&gt;
[codesnippet]DETAILS&lt;br&gt;
------------&lt;br&gt;
DataLayerSavingException&lt;br&gt;
  Invalid attempt to read when no data is present.&lt;br&gt;
InvalidOperationException&lt;br&gt;
  Invalid attempt to read when no data is present.&lt;br&gt;
&lt;br&gt;
Source     : MicroFour StrataFrame Business&lt;br&gt;
&lt;br&gt;
Stack Trace:&lt;br&gt;
   at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)&lt;br&gt;
   at System.Data.SqlClient.SqlDataReader.get_Item(String name)&lt;br&gt;
   at MicroFour.StrataFrame.Data.SqlDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler, Boolean RecreateCommand)&lt;br&gt;
   at MicroFour.StrataFrame.Data.DbDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler)&lt;br&gt;
   at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)&lt;br&gt;
   at MicroFour.StrataFrame.Business.BusinessLayer.Save(Boolean Transactional, String TransactionKey)&lt;br&gt;
   at MicroFour.StrataFrame.Business.BusinessLayer.Save()&lt;br&gt;
   at FOXSystems.RAMS.UI.Navigation.ListBONavBase.SaveData() in E:\FoxSystems\RAMS\trunk\RAMS.NET\RamsUI\Navigation\ListBONavBase.vb:line 418&lt;br&gt;
   at FOXSystems.RAMS.UI.Navigation.ListBONavManager._saveControl_Click(Object sender, EventArgs e) in E:\FoxSystems\RAMS\trunk\RAMS.NET\RamsUI\Navigation\ListBONavManager.vb:line 221&lt;br&gt;
   at System.Windows.Forms.Control.OnClick(EventArgs e)&lt;br&gt;
   at System.Windows.Forms.Button.OnClick(EventArgs e)&lt;br&gt;
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)&lt;br&gt;
   at System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks)&lt;br&gt;
   at System.Windows.Forms.Control.WndProc(Message&amp; m)&lt;br&gt;
   at System.Windows.Forms.ButtonBase.WndProc(Message&amp; m)&lt;br&gt;
   at System.Windows.Forms.Button.WndProc(Message&amp; m)&lt;br&gt;
   at System.Windows.Forms.Control.ControlNative&amp;#119;indow.OnMessage(Message&amp; m)&lt;br&gt;
   at System.Windows.Forms.Control.ControlNative&amp;#119;indow.WndProc(Message&amp; m)&lt;br&gt;
   at System.Windows.Forms.Native&amp;#119;indow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)&lt;br&gt;
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg)&lt;br&gt;
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)&lt;br&gt;
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)&lt;br&gt;
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)&lt;br&gt;
   at System.Windows.Forms.Application.Run(Form mainForm)&lt;br&gt;
   at MicroFour.StrataFrame.Application.StrataFrameApplication.RunApplication()[/codesnippet]</description><pubDate>Tue, 02 Oct 2007 17:52:32 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: DataLayer exception has me stumped</title><link>http://forum.strataframe.net/FindPost11805.aspx</link><description>I figured it out. It was an insert, the PK was an identity, but...&lt;br&gt;
&lt;br&gt;
I am doing some fancy auditing on this table, that includes an Instead Of Trigger. It does a bunch of updates to other tables, so the SCOPE_IDENTITY() function doesn't work.  I'm doing a conversion from an Access front end to .NET and was hoping to avoid this issue a while longer  :ermm:&lt;br&gt;
&lt;br&gt;
Thanks for getting me thinking though!  :D</description><pubDate>Tue, 02 Oct 2007 17:52:32 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: DataLayer exception has me stumped</title><link>http://forum.strataframe.net/FindPost11779.aspx</link><description>Was it an INSERT, UPDATE, or DELETE?&amp;nbsp; The only one that uses a DbDataReader (I think) is the INSERT, which it uses to retrieve the PrimaryKey that was assigned by the IDENTITY field.&amp;nbsp; So, it could be the case that there was not data returned... or that there is no IDENTITY on the field, or something like that.&amp;nbsp; Could you confirm whether the record is an INSERT, and also, it would help to see the last command that it tried to execute (by turning on DebugMode on the SqlDataSourceItem).</description><pubDate>Tue, 02 Oct 2007 08:56:03 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>