Page 1 of 1
CRUD SQL Lite Example ConnectionID issue
Posted: Mon May 30, 2011 5:49 am
by jesse
I am using townsends CRUD SQL Lite example. I have created a sub stack that will act as my record editing window. When a user double clicks a row on the datagrid a new substack opens allowing them to edit the individual fields. I wonder do I need to create a whole new connection to the database to access it from the substack or can i use the same database connection and if so how?
Re: CRUD SQL Lite Example ConnectionID issue
Posted: Mon May 30, 2011 6:49 am
by bangkok
jesse wrote:I am using townsends CRUD SQL Lite example. I have created a sub stack that will act as my record editing window. When a user double clicks a row on the datagrid a new substack opens allowing them to edit the individual fields. I wonder do I need to create a whole new connection to the database to access it from the substack or can i use the same database connection and if so how?
2 points of view to consider :
-good practices : people advocate to open connexion / send the query / close connexion. Every time. Up to you.
-technical : you can of course keep the same connexion within a substack, simply by storing the connexion ID in a global variable.
Re: CRUD SQL Lite Example ConnectionID issue
Posted: Mon May 30, 2011 5:56 pm
by jesse
Thanks. I want to follow best practice so I will go ahead and take your advice to open/close. I'm a php developer
so usually with PHP we just open the connection and keep it open during the life of the page so I guess
in comparison a stack should be looked at like a page.