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: Klaus, FourthWorld, heatherlaine, kevinmiller

jpottsx1
Posts: 46
Joined: Thu Jun 04, 2009 12:46 am
Contact:

Re: CRUD SQLite example

Post by jpottsx1 » Tue Sep 13, 2011 1:03 am

THX for the help. However I'm still not sure where the references to iHandle and iEnter come from any ideas?
Jeff G potts

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: CRUD SQLite example

Post by BarrySumpter » Tue Sep 13, 2011 2:59 am

function dbData iHandle, iEntry

They are the paramaters passed when calling this dbData function.

Do a search in the LC IDE Script Editor for dbData searching the entire stack.

You'll find where the call are being made and where the iHandle and iEntry is being assigned
by search for iHandle and iEntry in that tab.

If I had to guess iHandle would be the handle to the openDatabase and iEntry would be the key to that record.

hth
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

buchacho
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Fri Jun 14, 2013 10:22 pm

Re: CRUD SQLite example

Post by buchacho » Wed Sep 25, 2013 9:53 pm

When I try to "Update Row in DB" via the button, I get an answer of "0" so it is not completing the doUpdateRow command.

nyhBUSNbe9
Posts: 14
Joined: Thu Apr 19, 2012 9:29 am

Re: CRUD SQLite example

Post by nyhBUSNbe9 » Sun Jun 22, 2014 9:01 pm

i was just looking for a complete sql sample and your code comes closet to that many thanks that you share it.
Just one question how do you add a new record? when I select the pop up form it comes with a error message.
Thanks
Hans

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 » Tue Oct 27, 2015 6:01 pm

I've updated my CRUD SQLite example to LC 7.1. Here are some of the changes.

** Code for each operation is now within each button, not is the stack script.
** The actual name of the db file is controlled by 1 field in the stack script.
** dgHilitedIndex is used instead of dgHilitedline, as it is always an index that is returned.
** The one-function-does-everything, dbHandle has been removed, and will be updated separately.
** In 'Read Into db Into DataGrid", the dataGrid is updated one line at a time instead of all at once.
SQLite CRUD.jpg
CRUD_SQLite_example_v5.0.zip
(14.05 KiB) Downloaded 204 times

resty
Posts: 6
Joined: Tue Dec 13, 2016 11:01 pm

Re: CRUD SQLite example

Post by resty » Tue Dec 13, 2016 11:15 pm

Thank you, Paul Townsend. Much appreciated.

resty
Posts: 6
Joined: Tue Dec 13, 2016 11:01 pm

Re: CRUD SQLite example

Post by resty » Sun Dec 18, 2016 7:34 pm

Hello,
I'm trying to learn data grid using CRUD SQLITE example as a test application. The populate data group routine runs to completion with no errors, but no data is displayed on the grid. Wonder what''s going on. The following command appears to be what moves data to the grid. What is AddLine? I can't find any reference to it in the documentation.

dispatch "AddLine" to grp "myGrid" with temp

Need help. Thanks.

resty
Posts: 6
Joined: Tue Dec 13, 2016 11:01 pm

Re: CRUD SQLite example

Post by resty » Sun Dec 18, 2016 8:58 pm

I got it to work replacing the repeat loop (it's the Read db into Datagrid I was referring to).

repeat with ii = 1 to fld "rCounter"
put line ii of dlist into temp
dispatch "AddLine" to grp "myGrid" with temp
end repeat

with the statement:

set the dgText of group "myGrid" to ptext

What would I be missing by replacing the repeat loop with the statement above?

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 » Sat Apr 27, 2019 1:54 am

Excellent point Resty!
For code in the button, Read db into Datagrid...

Replace these lines:
repeat with ii = 1 to fld "rCounter"
put line ii of dlist into temp
dispatch "AddLine" to grp "myGrid" with temp
end repeat
With the statement:
set the dgText of group "myGrid" to ptext
Much faster!! Much better!

bogs
Posts: 4777
Joined: Sat Feb 25, 2017 10:45 pm

Re: CRUD SQLite example

Post by bogs » Sat Apr 27, 2019 12:00 pm

Hm. Did someone hack into townsend's account?
Image

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 » Sat Apr 27, 2019 4:42 pm

Yes. It's me! These days, I only have one application that still uses LiveCode. It's a web scraping application that I developed for my personal use. Also, I have become fairly proficient with two other development platforms. Above all, I always on the lookout for new technologies that will give me an edge in the marketplace.

BUT!!! Now with the advent of this LiveCloud.io offering, I see BIG opportunities ahead.

So... I'm back, actively coding in LiveCode again.

bogs
Posts: 4777
Joined: Sat Feb 25, 2017 10:45 pm

Re: CRUD SQLite example

Post by bogs » Sat Apr 27, 2019 4:50 pm

Welcome back then :D
Image

gagsoft
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

Re: CRUD SQLite example

Post by gagsoft » Mon May 27, 2019 2:25 pm

I am looking at the SQLite opening it with LC 8.1.6.
Looking at the scripts for the buttons no problem
When opening the same stack in LC ver 9.0.4 I am unable to open any button script.
It is as if I cannot go into edit mode.
What could be the reason for this?
Last edited by gagsoft on Tue May 28, 2019 8:55 am, edited 1 time in total.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7825
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: CRUD SQLite example

Post by FourthWorld » Mon May 27, 2019 3:02 pm

townsend wrote:
Sat Apr 27, 2019 4:42 pm
So... I'm back, actively coding in LiveCode again.
Welcome back.

While you were gone the engine team added the ability to specify sockets for UDP, so the lack of that which had brought this old P2P thread to a dead end had since been resolved:

viewtopic.php?f=11&t=18594&p=94376#p94376
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5466
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: CRUD SQLite example

Post by jacque » Mon May 27, 2019 6:21 pm

gagsoft wrote:
Mon May 27, 2019 2:25 pm
It is as if I cannot go into edit mode.
What could be the reason for this?
is debugging turned on in the Development menu?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”