Bug in FillByParent()
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


««12

Bug in FillByParent()Expand / Collapse
Author
Message
Posted 10/16/2007 1:57:50 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 05/15/2008 9:43:25 AM
Posts: 304, Visits: 1,198
Hi Ben,

The exception I'm getting when sch_SheduleBO1 is empty is: 'SQL Exception Unhandled by user code' Line 1: Incorrect Syntax Near ')'.

My Code:

Me.Sch_ScheduleBO1.FillAll()

Me.Sch_ScheduleDetailBO1.FillByParent()

If I add 1 record to my Sch_Schedule table, everything works fine.

I also attached the DEBUG information for the two fill methods.

Stacktrace:

   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.GetDataTable(QueryInformation QueryInfo, Boolean RegisterNotification)
   at MicroFour.StrataFrame.Business.BusinessLayer.FillOrGetByParentPrimaryKey(Object[] ParentPrimaryKeys, Boolean ReplaceCurrentDataTable)
   at MicroFour.StrataFrame.Business.BusinessLayer.FillOrGetByParent(BusinessLayer Parent, Boolean ReplaceCurrentTable)
   at MicroFour.StrataFrame.Business.BusinessLayer.FillByParent()
   at Avanti.Scheduling.frmMain.frmMain_Load(Object sender, EventArgs e) in C:\Source Code\Scheduling\Avanti Scheduling\Avanti Scheduling\Forms\frmMain.vb:line 75
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.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)

  Post Attachments 
SF_FillByParent.png (5 views, 35.28 KB)

Post #12035
Posted 10/19/2007 9:08:57 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 05/15/2008 9:43:25 AM
Posts: 304, Visits: 1,198
Just following up to see if I have a problem or if there is a small bug...

Thanks

Tim

Post #12090
Posted 10/19/2007 9:28:48 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 1:38:37 PM
Posts: 3,775, Visits: 3,950
I have not had a chance to set this up, but it would probably be a good idea to just add a test around the DetailBO1 before calling it. 

If ScheduleBO1.Count > 0 Then
    DetailsBO1.FillByParent()
End If

I will look into this though.

Post #12098
Posted 04/28/2008 3:02:40 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 2:40:45 PM
Posts: 305, Visits: 1,197
Hi Trent,

Just to let you know that today I was bit by the same issue, I got the same error.

Obviously using the count test will work in this case, but I think this should be fixed ASAP.

Edhy Rijo
Progytech (Computer Consultants)
Post #15960
Posted 04/28/2008 3:14:44 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 1:38:37 PM
Posts: 3,775, Visits: 3,950
From what I can tell the issue is that the parent BO doesn't have any records.  In that case, just test it prior to calling the Fill method...which is better anyway.  This is already on my list.  But you are ALWAYS better off being pre-emptive when dealing with emtpy tables, BOs, etc.
Post #15964
Posted 04/28/2008 3:20:06 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 2:40:45 PM
Posts: 305, Visits: 1,197
Trent L. Taylor (04/28/2008)
But you are ALWAYS better off being pre-emptive when dealing with emtpy tables, BOs, etc.

Yes, you are right, I have not even noticed that in the same form I was using the BO.count check as you suggested here and was blocked by the error, and even took the time to check the forums before posting.  Well I am still getting used to SF  and so far I love it

Edhy Rijo
Progytech (Computer Consultants)
Post #15965
« Prev Topic | Next Topic »

««12

Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 2:54pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.