Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UserSession and Datasets
#1
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!
Reply
#2
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!
Reply
#3
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,
Reply
#4
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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)