>Hi
>
>I use forms with private datasessions. However, since the forms can be opened multiple times I now have a problem using CursorAdapters because there can only be one cursoradapter object attached to a cursor. So the cursorattach function fails on any table previously opened in the 1st form.
>
>Sometimes I open a table in a form again using another alias but this table also cannot have a cursoradpater attached to it.
>
>It appears that the only solution is to detach the cursoradapter from one table and attach it to another but this is a pain with multiple forms using private datasessions.
>
>Is there some other solution? I was hoping that you could attach a cursoradapter to each open table in all the open forms.
>
>Thanks
>Simon
Hi Simon,
Could you post a simple repro for your scenario?
It is possible to have one CursorAdapter per cursor, I don't have any problem with the following code:
CLOSE DATABASES all
clear
SET MULTILOCKS ON
CREATE table foo1 (f1 I)
USE
USE foo1 SHARED
USE foo1 IN 0 ALIAS foo2 AGAIN
oca1=CREATEOBJECT("CursorAdapter")
oca2=CREATEOBJECT("CursorAdapter")
?oCA1.CursorAttach("foo1")
?oCA2.CursorAttach("foo2")
?oCA1.CursorStatus,oCA1.Alias,GETCURSORADAPTER(oCA1.Alias),DBF(oCA1.Alias)
?oCA2.CursorStatus,oCA2.Alias,GETCURSORADAPTER(oCA2.Alias),DBF(oCA2.Alias)
oSess=CREATEOBJECT("Session")
SET DATASESSION TO oSess.DataSessionId
SET MULTILOCKS ON
oca3=CREATEOBJECT("CursorAdapter")
USE foo1 IN 0 ALIAS foo3 AGAIN SHARED
?oCA3.CursorAttach("foo3")
?oCA3.CursorStatus,oCA3.Alias,GETCURSORADAPTER(oCA3.Alias),DBF(oCA3.Alias)
return
Thanks,
Aleksey.