Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 20 of 23 total
Thread ExecSQL in ewb
Tue, Jun 30 2015 7:21 AMPermanent Link

Huseyin Aliz

myBiss ApS

Avatar

Great, thanks, i will look at it Smile

Regards,
Hüseyin

Den 30-06-2015 kl. 13:12 skrev Uli Becker:
> Hüseyin,
>
>  > I am a beginner yet, and unfortunately i dont know much about using
>> modules with ewb, so if you can share a little sample code it could be
>> very nice Smile
>
> I just posted one of my modules in the Binaries Newsgroup (Sample Module
> for Michale Saunders), hopefully that will help you.
>
> Uli
>
Tue, Jun 30 2015 9:06 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Hüseyin,

<< Is it possible to use execsql (or how to use similar command) to delete
some rows from dbisam dataset? >>

Not directly, no.  You would have to use a query to retrieve the row(s) that
you want to delete, start a transaction, delete the row(s), and then commit
the transaction.  EWB assumes that any rows you want to delete are also rows
that you want to use in the client application to display to the user, etc.,
otherwise why ship them over to the client ?

You can also, of course, use a web server module to accept a specific server
request for deleting row(s) from a table.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jun 30 2015 9:08 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Hüseyin,

<< It shows an error "Error creating table handle" but deletes rows from the
table. >>

That's because it's not a SELECT statement, but a DELETE statement.  EWB
always expects a table/query specification for defined datasets.

Tim Young
Elevate Software
www.elevatesoft.com






Tue, Jun 30 2015 9:11 AMPermanent Link

Raul

Team Elevate Team Elevate

On 6/30/2015 5:20 AM, Hüseyin Aliz wrote:
> Database.StartTransaction;

Curious but what do you expect this to do ?

EWB transaction is not the same thing as a database transaction - they
are a way to capture local changes to EWB dataset so they can be sent to
the back end server once you commit.

Hence just calling LoadRows should be enough (no need for transaction etc).

The back-end (web-server) would need to run its own database transaction
to ensure changed received are processed as single entity (if that's
what you wish to do on the back-end).

> It shows an error "Error creating table handle" but deletes rows from
> the table. I also tried to replace Database.Loadrows(SletDetail); with
> Open; but nothing happens - no error messages, no deletion of rows..

The query you have does not appear to return anything - it's just a
delete. I'd suggest making the row source something like this (2
separate sql statements with last one actually returning data):

delete from orders
where ordernumber={ordernumber=1000};
select * from orders;


Raul
Tue, Jun 30 2015 12:35 PMPermanent Link

Huseyin Aliz

myBiss ApS

Avatar

Raul,

2 grids, one for the selection of the items, and second for the
insert/update to the dataset.

My scenario is presenting a grid based on items table to the user, and
when she/he selects a record it automatically updates orderlines table
(another grid). If they decide to clear all selections i have to delete
all orderlines from the tables (dataset) and empty the second grid for
records, and the code you wrote works perfect SmileI just didn't know that
several sql statements could be used, so much to learn Smile

Another idea i have been thinking of, is to populate a non-bound grid
with selections, and when the user finally confirms i could use a while
loop to assign from grid to dataset with a transaction, but i am not
sure how to populate the grid without dataset assignment.

Thanks for the input Smile

Regards,
Hüseyin


On 30-06-2015 15:11, Raul wrote:
> delete from orders
> where ordernumber={ordernumber=1000};
> select * from orders;

Tue, Jun 30 2015 12:37 PMPermanent Link

Huseyin Aliz

myBiss ApS

Avatar

Tim,

Please see my reply to Raul Smile

Regards,
Hüseyin

On 30-06-2015 15:06, Tim Young [Elevate Software] wrote:
> Hüseyin,
>
> << Is it possible to use execsql (or how to use similar command) to
> delete some rows from dbisam dataset? >>
>
> Not directly, no.  You would have to use a query to retrieve the
> row(s) that you want to delete, start a transaction, delete the
> row(s), and then commit the transaction.  EWB assumes that any rows
> you want to delete are also rows that you want to use in the client
> application to display to the user, etc., otherwise why ship them over
> to the client ?
>
> You can also, of course, use a web server module to accept a specific
> server request for deleting row(s) from a table.
>
> Tim Young
> Elevate Software
> www.elevatesoft.com

Tue, Jun 30 2015 1:50 PMPermanent Link

Raul

Team Elevate Team Elevate

On 6/30/2015 12:35 PM, Hüseyin Aliz wrote:
> My scenario is presenting a grid based on items table to the user, and
> when she/he selects a record it automatically updates orderlines table
> (another grid). If they decide to clear all selections i have to delete
> all orderlines from the tables (dataset) and empty the second grid for
> records, and the code you wrote works perfect SmileI just didn't know that
> several sql statements could be used, so much to learn Smile

I would suggest you use the EWB facilities for this and not delete SQL
as i believe that would be cleaner solution.

I assume the orderlines will not be very large (10s of items usually).

You load it from server (LoadRows) and then start transaction.
- If user adds a row you just insert into dataset
- if user removes row you remove from dataset
- if user wants to remove all then you just loop thru and delete all
dataset records

Then ou call commit - this would now take the changes and send them to
server so they get applied to database.

General idea is that local orderlines is always in transaction mode and
you commit whenever you need to save changes to back end DB and then put
dataset back into transaction.


> Another idea i have been thinking of, is to populate a non-bound grid
> with selections, and when the user finally confirms i could use a while
> loop to assign from grid to dataset with a transaction, but i am not
> sure how to populate the grid without dataset assignment.

See above - i think using transaction on bound dataset will be easier

Raul
Wed, Jul 1 2015 2:47 AMPermanent Link

Godfrey

Ultimatesoft

Raul wrote:

<<You load it from server (LoadRows) and then start transaction.
- If user adds a row you just insert into dataset
- if user removes row you remove from dataset
- if user wants to remove all then you just loop thru and delete all
dataset records

Then ou call commit - this would now take the changes and send them to
server so they get applied to database.>>

Where can I find some sample code to do this using a non elevate database?  ADO connection.

Thanks
Godfrey
Wed, Jul 1 2015 6:28 AMPermanent Link

Huseyin Aliz

myBiss ApS

Avatar

Hi Raul,

I think i may have not explained my situation very well, i am adding
orderlines and not updating the orderlines

Here's what i do now (working but may not be optimal solution).

- When user clicks a button (menu), a new form is created with a new
order number assigned.
- When user enters the form, items grid are populated with items (5-10
max) lines.
- User selects the items to be inserted to the orderline dataset, and
orderline will be posted to the dataset with a transaction.

if user decides to remove all lines, i am now using the method
(suggested by you) by deleting from dataset and afterwards select * from.
So to start with, there are no orderlines

I will try to see if i can implement your suggestion, thanks again for
your input

Regards,
Hüseyin

On 30-06-2015 19:50, Raul wrote:
>
>
> General idea is that local orderlines is always in transaction mode
> and you commit whenever you need to save changes to back end DB and
> then put dataset back into transaction.
>
> See above - i think using transaction on bound dataset will be easier
>
> Raul
Wed, Jul 1 2015 6:35 PMPermanent Link

Raul

Team Elevate Team Elevate

On 7/1/2015 2:47 AM, Godfrey wrote:
> Where can I find some sample code to do this using a non elevate database?  ADO connection.
>

Godfrey,

Can you clarify what sample code do you need ?

EWB code would be same whether it's elevate database or something else
since EWB just talks JSON to the back end.

While i not not tried it with ADO connection myself if you're using "EWB
Web Server" it should just work as long as you configured the dataset
connection properly.

Raul


« Previous PagePage 2 of 3Next Page »
Jump to Page:  1 2 3
Image