[V4RB-Vserve] what is the fastest add records method?

Fred.Stephenson Fred.Stephenson at communication-unltd.com
Mon Jan 31 16:44:20 CST 2005


>

Oops maybe I should read the mail properly
Where is your flush
I take it you mean "if cursor.add" as you stipulate no records for your cursor
if so then
Cursor = thedatabase.sqlselect("select recid,* from table where recid=0",2,1,1)


>
>I have to add several records (up to 100) in a single method.
>
>Basically, the user enters some values in a Listbox, with many rows and 10
>columns).
>When she wants to save, a method loops into all rows and records, and adds
>as many records that there are rows in the listbox.
>
>I use this kind of method :
>
>Dim r, c as integer
>Dim field, value as string
>Dim cursor as Vcursor
>
>' create a non nil cursor with no records in the good table:
>Cursor = thedatabase.SQLSelect("SELECT * FROM myTable WHERE myField =
>'whatever'", 2, 1, 1)
>
>For r = 0 to ListBox1.listcount - 1
>
>     cursor.setblank
>
>     for c = 0 to ListBox1.columncount-1
>
>         field = ListBox1.heading( c )
>         value = ListBox1.cell(r, c)
>
>         cursor.field(field).setstring value
>
>     next
>
>     if cursor.update = false then
>         MsgBox "oops"
>     end if
>
>Next
>
>But this runs surprisingly slowly. I used to seeing Valentina running much
>faster than that.
>
>Thus this kind of method runs fast for updates.
>
>Is there a faster method?
>
>I think that SQLExecutes are too dangerous, because they may update all the
>records in the table if the "WHERE" statement is skipped for any reason.




>
>Thanks all
>Eric
>
>_______________________________________________
>Valentina mailing list
>Valentina at lists.macserve.net
>http://lists.macserve.net/mailman/listinfo/valentina


-- 
Great Britain was given
  God to Save the Queen
and
the NHS to kill her subjects
[Fred Stephenson August 27 2004]

J T Stephenson died Nov. 23rd 2004
cause of death :
Gross negligence and incompetence


More information about the Valentina mailing list