Page 2 of 5

Re: CRUD SQLite example

Posted: Thu May 26, 2011 4:32 pm
by jesse
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...?

Re: CRUD SQLite example

Posted: Thu May 26, 2011 6:05 pm
by townsend
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.

Re: CRUD SQLite example

Posted: Thu May 26, 2011 10:59 pm
by BvG
Nice!

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

maybe make a presentation about it on www.livecode.tv ?

Re: CRUD SQLite example

Posted: Thu May 26, 2011 11:23 pm
by jesse
townsend,

thanks i'll check it out again. and your welcome :)

Re: CRUD SQLite example

Posted: Fri May 27, 2011 4:20 pm
by townsend
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.

Re: CRUD SQLite example

Posted: Fri May 27, 2011 7:51 pm
by bn
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

Re: CRUD SQLite example

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

Re: CRUD SQLite example

Posted: Mon May 30, 2011 6:57 pm
by townsend
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.

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 10085 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 10110 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.