StrataFrame Forum

dataset showing count as 1 when should be 0

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

By Diu King,Tiong - 1/25/2011

Hi all,

I query the data and fill into my dataset, there is 0 record found but my dataset.table(0).rows.count = 1.

Please advice how do i detect if no record find with the dataset?


Thanks
By Trent L. Taylor - 1/26/2011

Do you have a filter applied to your BO or did you call the Add or NewRow of the BO?  If not, then what does your query look like and code that is retrieving the data?
By Diu King,Tiong - 1/26/2011

Hi Trent,

My coding like,

                            Dim ds5 As Data.DataSet = New Data.DataSet
                            Dim sqlcmd5 As SqlCommand = New SqlCommand("select max(cPybRefDoc) as maxno from hrptpaybat where iPybPeriod_FK = " & _
                                                                       tiPeriod_PK & " and left(cPybRefDoc,3) = 'SYS'", db.sqlconn)
                            sqlcmd5.Connection = db.sqlconn
                            sqlcmd5.Transaction = tran
                            sqlcmd5.ExecuteNonQuery()
                            Dim da5 As SqlDataAdapter = New SqlDataAdapter(sqlcmd5)
                            da5.Fill(ds5)
                            If ds5.Tables(0).Rows.Count = 0
                            ................................
                            ................................

even though there is no record queried but my dataset still showing 1 record with null value.


Regards
By Trent L. Taylor - 1/26/2011

In this example, you are not using StrataFrame at all.  Why aren't you using a business object to manage your connections, query, etc.?  I am just trying to understand as the code you provided has nothing to with StrataFrame, so before we go to the next step, I just wanted to make sure that I wasn't missing something here.
By Diu King,Tiong - 1/26/2011

Yes Trent, I'm not using strataframe in my blackbox's processing, I scare to use object will delay my processing time from my experience with other framework before.
By Trent L. Taylor - 1/27/2011

Well, you would be mistaken in regards to performance.  We have an extremely large medical application that deals with massive databases including an online portion of our product that deals with insurance formularies and over 400 million records, and we use business objects.