Atozed Forums
UserSession and Datasets - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: UserSession and Datasets (/thread-921.html)



UserSession and Datasets - lfeliz - 01-25-2019

Hello,

I recall some time in the past a post recommending that when utilizing data sets on user connection that is advised to reconnect the dataset to the db connection used in the usersession.  I no longer put datasets on forms.  I have never had any issue with apps I have developed, though I am always setting the db connection parameters when each session is being created, but leave all of the design time connections in place.  Anyway, I am currently working on app that may have hundreds of users I was just thinking if this was the recommended practice or am I good to keep doing the same as I always have done.

Thanks for listening.

Cheers!


RE: UserSession and Datasets - TonyNZ - 01-25-2019

When I first started IW development (back in the days of version 9) I made the mistake of having a dataset on a form, which resulted in users "seeing" other user's data! Since then I have always had the database connection and datasets on the UserSession. I have done both, as in a lot of datasets on the UserSession that a form opens / closes as necessary. In recent years I have mostly had a form call an appropriate UserSession function(s) that reads / writes the data for the form. I have found this easier to maintain than looking at a UserSession that has 20 - 30 datasets on it!


RE: UserSession and Datasets - zsleo - 01-25-2019

Hi,

At runtime you should reset (that is re-apply) the dataset connection in the BeforeOpen event of each dataset.

I do this now as a matter of course on all forms, frames, data modules and user session units.

Have not had an issue since implementing this approach. 

Best regards,


RE: UserSession and Datasets - lfeliz - 01-26-2019

Thanks. I am going to implement a generic Before Open event. This will help as I plan tosupport option of having a multi-tenant or single tenant database depending on support level required.

Cheers!