CRUD SQLite example

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

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

Re: CRUD SQLite example

Post by jesse » Thu May 26, 2011 4:32 pm

works great! it really helped me to get the understanding a bit more and run some testing. How can I set column dynamically from the code? I see
you have hardset the number of columns. Is it possible to set this information in the code as well as the column widths, and fonts, etc...?
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: CRUD SQLite example

Post by townsend » Thu May 26, 2011 6:05 pm

jesse wrote:How can I set column dynamically from the code? Is it possible to set this information in the code as well as the column widths, and fonts, etc...?
Yes-- that's certainly possible, but that would be part of the DataGrid example.

Here's a Stack that will show you how that is done. It's one of my favorites.
DataGrids Tour: http://revonline2.runrev.com/stack/229/Data-Grids-Tour

And here are a whole bunch of other good DataGrid lessons:
http://lessons.runrev.com/spaces/lesson ... =Data+Grid

If you get stuck start a new thread.

PS: Thanks for you help on my DB question.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: CRUD SQLite example

Post by BvG » Thu May 26, 2011 10:59 pm

Nice!

i suggest uploading it to revOnline ("user samples") too!

maybe make a presentation about it on www.livecode.tv ?
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

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

Re: CRUD SQLite example

Post by jesse » Thu May 26, 2011 11:23 pm

townsend,

thanks i'll check it out again. and your welcome :)
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: CRUD SQLite example

Post by townsend » Fri May 27, 2011 4:20 pm

BvG wrote:Nice!
i suggest uploading it to revOnline ("user samples") too!
maybe make a presentation about it on http://www.livecode.tv ?
Thanks! Let me get this uploaded to revOnline, then we can
talk about me doing a short presentation.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3991
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: CRUD SQLite example

Post by bn » Fri May 27, 2011 7:51 pm

Hi Paul,

thank you for the stack. Maybe I finally get around to dig into sql thanks to your example. I actually understood what was going on. :)

Kind regards

Bernd

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

Re: CRUD SQLite example

Post by jesse » Mon May 30, 2011 6:02 pm

townsend,

I have tried running for CRUD Example as a standalone on Windows but it doesn't seem to update the datagrid
after Connecting, Create Table, Populate, and then when I click Read into Datagrid nothing happens. Any suggestions?
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: CRUD SQLite example

Post by townsend » Mon May 30, 2011 6:57 pm

Yes-- I see that message, "Table 'Users' Updated Successfully" is somewhat
confusing. I've changed it to read, "Selected Row Updated Successfully"
I've attached an updated version.

ALSO-- a much more important change to this version has to do with a
slightly poor coding practice I discovered. Previously, all the exit statements
had included the Hander name. These have all been replaced with the
more generic "exit to top" key phrase, which does the same thing.

This way if you ever want to copy and rename the Handler, you only
need to change the name in two places: at "on name ... exit name"
instead of three or four, or many more in more complex Handlers.
Attachments
CRUD_SQLite_example_v3.3.zip
(7.62 KiB) Downloaded 323 times

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

Re: CRUD SQLite example

Post by jesse » Mon May 30, 2011 7:02 pm

Thanks for the update. Still I have no clue why when I compile as a standalone none of the buttons that are supposed to manipulate the datagrid are working.
I tried clear datagrid, and read into datagrid but nothing changes on the datagrid. Of course everything works fine while in development mode.

Any ideas?
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: CRUD SQLite example

Post by townsend » Mon May 30, 2011 7:55 pm

I didn't even think to create a Standalone. You're right. The DtataGrid was frozen.
I tried everything I could think of. Nothing worked. So, I just deleted the DataGrid
and created a new one, with the same name. Works good now.
102 CRUD SQLite example 3.5.JPG
102 CRUD SQLite example 3.5.JPG (54.63 KiB) Viewed 9967 times
Attachments
CRUD_SQLite_example_v3.5.zip
(8.89 KiB) Downloaded 353 times

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

Re: CRUD SQLite example

Post by jesse » Mon May 30, 2011 8:45 pm

That is very odd. I used your CRUD script as a starting point for my script and had the same problem with the datagrid
not working. Sure enough like you mentioned I deleted the grid and re-created it and it works now. If you happen to find
out what the issue was please let me know as I can't figure it out for the life of me. Thanks again for your help!
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: CRUD SQLite example

Post by townsend » Wed Jun 01, 2011 3:56 pm

did you update the download on the other post? i would love to download
it once its updated. its really helped me to understand how to do things more.
Okay-- Here's the updated version, with the dynamic column names.
103 CRUD SQLite example 3.6.JPG
103 CRUD SQLite example 3.6.JPG (60.74 KiB) Viewed 9992 times
Attachments
CRUD_SQLite_example_v3.6.zip
(9.47 KiB) Downloaded 358 times

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: CRUD SQLite example

Post by BvG » Wed Jun 01, 2011 4:22 pm

Hi

please make a presentation on livecode.tv about the sql example stack, it's so grand! Please contact me at bvg AT mac DOT com.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: CRUD SQLite example

Post by mwieder » Wed Jun 01, 2011 8:08 pm

Oooo - I second that - this would make a great presentation for livecode.tv

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: CRUD SQLite example

Post by townsend » Wed Jun 01, 2011 10:34 pm

Thanks for the encouragement guys!
Yeah-- sure-- I'd be glad to do a presentation for livecode.tv
after I finish at the Summer Academy. (3 weeks left)
There's not much to the example. If I ALSO went over the basics of
the SQL manager, SQLiteMan, then I probably could do 20-30 minutes.

BvG-- I'll send you an email about this. Also, I've been trying to
log into RevOnline for days now. It looks like they're not accepting
uploads right now.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”