1

i am working with a vbaccelerators' sgrid and need to load records as fast as i can.

am want ti use a recordset (am already using a collection) to store loaded records so that i effect any changes to the grid on it, save the changes to the recordset until i click save, then update the database with the recordset.

currently i load data from database to collection, from collection to grid. this makes the app slow for over 10k records which have to all be loaded once not in batches. using a recrdset will avoid two looping as i mentioned above.

my questions is how to i insert, delete, update specifi record(s) in a recordset? are there any utility classes or libraries to acheive this?

thanks

Smith
  • 5,765
  • 17
  • 102
  • 161
  • Assuming you're using ADODB recordsets: This might help: http://stackoverflow.com/questions/2293933/how-to-properly-add-new-records-to-empty-recordset-manually – Brandon Moore Dec 20 '12 at 09:52
  • thanks, thats for adding new records, what about update and delete specific records in a recordset – Smith Dec 20 '12 at 13:10

2 Answers2

0

You can also use connection's execute method like below. Just write normal sql insert query and pass to connection execute method.

 Dim strConnection As Strin
 strConnection = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=SepsisQStar"
 Set gcnMain = New ADODB.Connection
 gcnMain.Open strConnection


strCom =  "INSERT INTO RawData (FileName, FileTimeStamp, SampleName, MOverZ, Intensity) VALUES ('"
              strCom = strCom & FileName & "','"
              strCom = strCom & FileTimeStamp & "','"
              strCom = strCom & SampleName & "',"
              strCom = strCom & MoverZ & ","
              strCom = strCom & Intensity & ")"


gcnMain.Execute strCom, , adCmdText 
C-Pound Guru
  • 15,967
  • 6
  • 46
  • 67
DevelopmentIsMyPassion
  • 3,541
  • 4
  • 34
  • 60
  • thanks, for answering, but i was talking more about manipulating recordset. i dont want to save changes to the database immediately because i am implementing an undo redo functionality, so its only when save is clicked that the changes get saved – Smith Dec 21 '12 at 19:48
0

Have you seen below link

VB6 ADODB Record Set Update

This will help you to update record

Community
  • 1
  • 1
DevelopmentIsMyPassion
  • 3,541
  • 4
  • 34
  • 60