CRUD SQL Lite Example ConnectionID issue

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jesse
Posts: 205
Joined: Thu Nov 11, 2010 6:32 pm

CRUD SQL Lite Example ConnectionID issue

Post by jesse » Mon May 30, 2011 5:49 am

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?
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: CRUD SQL Lite Example ConnectionID issue

Post by bangkok » Mon May 30, 2011 6:49 am

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.

jesse
Posts: 205
Joined: Thu Nov 11, 2010 6:32 pm

Re: CRUD SQL Lite Example ConnectionID issue

Post by jesse » Mon May 30, 2011 5:56 pm

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.
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

Post Reply