Page 4 of 5

Re: CRUD SQLite example

Posted: Tue Sep 13, 2011 1:03 am
by jpottsx1
THX for the help. However I'm still not sure where the references to iHandle and iEnter come from any ideas?

Re: CRUD SQLite example

Posted: Tue Sep 13, 2011 2:59 am
by BarrySumpter
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

Re: CRUD SQLite example

Posted: Wed Sep 25, 2013 9:53 pm
by buchacho
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.

Re: CRUD SQLite example

Posted: Sun Jun 22, 2014 9:01 pm
by nyhBUSNbe9
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

Re: CRUD SQLite example

Posted: Tue Oct 27, 2015 6:01 pm
by townsend
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 445 times

Re: CRUD SQLite example

Posted: Tue Dec 13, 2016 11:15 pm
by resty
Thank you, Paul Townsend. Much appreciated.

Re: CRUD SQLite example

Posted: Sun Dec 18, 2016 7:34 pm
by resty
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.

Re: CRUD SQLite example

Posted: Sun Dec 18, 2016 8:58 pm
by resty
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?

Re: CRUD SQLite example

Posted: Sat Apr 27, 2019 1:54 am
by townsend
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!

Re: CRUD SQLite example

Posted: Sat Apr 27, 2019 12:00 pm
by bogs
Hm. Did someone hack into townsend's account?

Re: CRUD SQLite example

Posted: Sat Apr 27, 2019 4:42 pm
by townsend
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.

Re: CRUD SQLite example

Posted: Sat Apr 27, 2019 4:50 pm
by bogs
Welcome back then :D

Re: CRUD SQLite example

Posted: Mon May 27, 2019 2:25 pm
by gagsoft
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?

Re: CRUD SQLite example

Posted: Mon May 27, 2019 3:02 pm
by FourthWorld
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

Re: CRUD SQLite example

Posted: Mon May 27, 2019 6:21 pm
by jacque
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?