VB6 Performance Tip (Sort an array using ADODB.Recordset)
Classic VB6 petition on the internet a while ago was fun. Check out for example this petition following the original IDL petition. Finally someone in Microsoft understood that something is going wrong and MSDN had launched Visual Basic 6.0 Resource Center several days ago. William Ryan called it Throwing a bone to the VB6ers .
A lot people contributed their opinion to the petition, VB6 and not VB6 developers. I only throw my 2 cents here (yes, I used to be VB6 and ASP developer once). Here goes my VB6 performance tip - Sort an array using ADODB.Recordset. Check it out:
cData = "one;two;three;three;four" aData = Split(cData,";") Set oRS = CreateObject("ADODB.Recordset") oRS.Fields.Append "data", 200, 100 oRS.Open For Each cItem In aData oRS.AddNew oRS("data") = cItem oRS.Update Next oRS.Sort = "data" oRS.MoveFirst While Not oRS.EOF If oRS("data") = cPred Then oRS.Delete Else cPred = oRS("data") End If oRS.MoveNext Wend oRS.MoveFirst oRS.Sort = "" aData = Split(oRS.GetString(2,,"","|"),"|")
It turns out that VB6 is a bit more complicated than it seems to be, isn't it ? Hope you understand the piece of code and got the idea behind it.
Monday, April 11, 2005 4:05 AM