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

Olivier vidal_olivier at yahoo.fr
Mon Jan 31 15:42:56 CST 2005


Hi Eric,

It is not the access to the listbox that is slow?

olivier

(ce n'est pas l'accès à la listbox qui ralentit l'opération ? essayez 
peut-être avec un tableau en RAM pour voir si le problème n'est pas à 
ce niveau)

Le 31 janv. 05, à 15:11, Eric Ferrer a écrit :

>
> Hello all,
>
> 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
>



More information about the Valentina mailing list