StrataFrame Forum

How do I trap for no records found?

http://forum.strataframe.net/Topic2496.aspx

By StarkMike - 8/28/2006

If I attempt to fill a BO and the critera I used returns zero records.... how do I handle that gracefully? Right now I get an error: "Cannont convert "" to integer".



Thanks
By Trent L. Taylor - 8/28/2006

It depends on how you are filling the business object.  All binding logic already takes this into account so basic StrataFrame binding will not generate this error since we remove the binding when there are no records.  But you can use teh CurrentDataTableRefilled method and then look at the Count property of the BO.
By StarkMike - 8/28/2006

I'm filling the busines object using Me.FillDataTable(cmd). I'll check it out in the morning. Thanks
By Trent L. Taylor - 8/28/2006

Let me know if you have any questions.  We may not have 2 minute responses since we are out of town, but we are keeping on top of the forum Smile
By StarkMike - 8/29/2006

Is there a way I can cancel the ListPopulating event if my primary business object returned zero rows?
By Trent L. Taylor - 8/29/2006

All you need to do is attempt to populate before you call the Requery method of the ListView.  This way the ListPopulating event will never even be called and the list will not attempt to re-populate.  One thing that you will probably want to do is set the PopulateOnFormLoad to manual which means the list will not populate unless you call the Requery method of the ListVIew.