Last post Feb 01, 2011 07:55 AM by Hamishrock
Feb 01, 2011 05:25 AM|Hamishrock|LINK
I am running the code below to read a sql table and populate the values into a list.
This works on the first run through, but after the data has been processed, and the process then re runs, if the sql table has been modified externally, the read of the records does not change. I imagine it is being cached somwhere but as I re dim the dData
variable, shouldn't it all be dropped and run afresh?
'make sure that the list is empty
'Select the table to extract the data from and create the SQL
dData = From i In DB.DLT_Log _
Where i.cleared_date Is Nothing And i.update_date IsNot Nothing And i.Comment Is Nothing _
Order By i.Id _
'now run the SQL and for each row add the data to the list item
For Each dItem In dData
Dim DataX As TicketData = New TicketData
DataX.Id = dItem.id
DataX.Action = dItem.action
DataX.ClearedDate = dItem.cleared_date
DataX.Comment = dItem.comment
DataX.RecordDate = dItem.record_date
DataX.CreatedBy = dItem.created_by
DataX.CreateDate = dItem.create_date
DataX.UpdateDate = dItem.update_date
'add the list items to the list
Feb 01, 2011 07:16 AM|sudeep_13|LINK
You can Dispose the object after it is used so that next time a new object will be created and filled.
Feb 01, 2011 07:55 AM|Hamishrock|LINK
Dispose is not available on dData, so I set to nothing, and then re ran from the dDate= from ..................etcetc
But it refilled it with the original data rather than the db table's data ???