Page 2 of 5

Re: CRUD SQLite example

Posted: Mon May 30, 2011 7:02 pm
by jesse
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?

Re: CRUD SQLite example

Posted: Mon May 30, 2011 7:55 pm
by townsend
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 26210 times

Re: CRUD SQLite example

Posted: Mon May 30, 2011 8:45 pm
by jesse
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!

Re: CRUD SQLite example

Posted: Wed Jun 01, 2011 3:56 pm
by townsend
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 26233 times

Re: CRUD SQLite example

Posted: Wed Jun 01, 2011 4:22 pm
by BvG
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.

Re: CRUD SQLite example

Posted: Wed Jun 01, 2011 8:08 pm
by mwieder
Oooo - I second that - this would make a great presentation for livecode.tv

Re: CRUD SQLite example

Posted: Wed Jun 01, 2011 10:34 pm
by townsend
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.

Re: CRUD SQLite example

Posted: Wed Jun 08, 2011 6:18 pm
by townsend
I finally finished this SQlite database example. It's chock full of tight,
good-as-can-be code. I wrote it to be my own personal reference,
but I'm sure other LiveCode beginners will find a lot good code here,
to cut and paste into your own application. Maybe save some time,
instead of trying to figure this stuff out from scratch.
108 CRUD SQLite example 4.3.JPG
I've added new Buttons and Handlers to the main Stack.

AND created a new Sub-Stack called Preferences. This is a single
function called dbData-- that you can use-- to easily save and retrieve
any value in your application, including entire DataGrids. As a single
function, you can simply copy and paste the whole thing into any application.

It's clean, well commented code. Also as is often the case when coding,
we must choose between better efficiency or better readability.
I always opt for better readability and ease of maintenance,
especially in a compiled environment like LiveCode.

Re: CRUD SQLite example

Posted: Thu Jun 09, 2011 4:47 am
by jesse
Great job! Only problem I see so far is when I try to edit a row and click the update button it says updated but when i refresh the grid the row is not
updated anymore. am i missing something?

also just a silly spelling error but the comment "row in table control updated sussefully" should be successfully of course.

Re: CRUD SQLite example

Posted: Thu Jun 09, 2011 3:07 pm
by townsend
Got that typo corrected-- but the Update Row seems to work okay.

First highlight a Row, then press the Update button.

Refresh, brings it back fine over here.

Anyone else having this problem?

Re: CRUD SQLite example

Posted: Sun Jun 12, 2011 4:54 pm
by townsend
I found more typos. The name Entry was originally Value, but was changed to
avoid confusion with the SQL keyword VALUE. These are the corrected Usage
Instructions for the dbData function.
This Stack contains a single funcion, which Inserts, Updates,
and Reads rows in a SQLIte file called, System.data.
Usage: dbData (Handle, Entry)
If 'Handle' already exists 'Entry' is Updated instead of Inserted.
Null in 'Handle' closes connection.
Null in 'Entry' returns retrieved Entry.
Successful Inserts & Updates return 'ok'.
Any errors, return details, prefixed with the word, 'ERROR'.
If you use this stack, just paste them into the Contents of the Display field.

Re: CRUD SQLite example

Posted: Sun Jun 12, 2011 8:12 pm
by paul_gr
Thanks Townsend,
useful example -- it's appreciated.

Paul

Re: CRUD SQLite example

Posted: Sun Aug 07, 2011 11:44 pm
by townsend
This weekend I did a short presentation going over this CRUD SQLite Example.

Here's the link to the video: http://dl.dropbox.com/u/35256958/CRUD-Example-video.mp4
(Note: this link should be good until the end of the month. Aug-2011.)

Also here's a minor update.Version 4.4.

Re: CRUD SQLite example

Posted: Mon Aug 08, 2011 2:59 am
by BarrySumpter
Nice!
Great work on the video!
And thanks for the update!

Re: CRUD SQLite example

Posted: Tue Aug 09, 2011 2:56 pm
by BvG
The video is also available from the livecode.tv site:

http://blog.livecode.tv/2011/08/event-35-wrap-up/