CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 custom insert works and custom update/delete does not

Print topic Send  topic

Author Message
viktor
Posted: 04/13/2004, 12:33 AM

environment
=======
php+mysql

situation
========
I have to tables: 'country' and 'region'

table 'country' has the following fields
country_id, country_name, country_region_id

table 'region' has the followinf fields
region_id, region_name

my task
========
to have ONE form to insert / update table country.

what I've done so far.
==================
I've tried both grid based on query
and
editable grid based on query

what i achieved
===========
I can make it working with CUSTOM insert only
I use 'data' tab on properties and in 'Custom Insert' put TWO FIELDS / bindings:

* country_name (field) to country_name (control)

* region_id (field) to country_region_id (control)

and it works. I did not use country_id since autoincriment works with it.

I've tried to do the same with 'Custom Update' and 'Custom Delete' and failed.

Question
==========
What could I be doing wrong when building 'Custom Update' and 'Custom Delete'?

Also what is the approach for 'Custom Delete' to build property 'where' statement?

Thank you in advance


peterr


Posts: 5971
Posted: 04/13/2004, 11:45 AM

Which table are you inserting to in your custom Insert? Only one table can be selected and I'm not sure which one you used, but I'm assuming that it is country?
You would need to select the same table in the CustomUpdate and Custom Delete. The "Where" parameter for Custom Delete should specify one of the fields on your form, for example country_id or country_name.

However, I think that you should take a different approach and simply use one table as the data source for your grid, without using Custom operations.
The Editable Grid examples in CCS Example Pack do basically the same thing. They both are based on the departments and employees tables, structured in similar way to yours. While you are assigning a region_id to a country, our examples assign emp_id to a department. At least I don't see any functional differences.
The table that we're updating is "departments" (and I'm assuming you're updating "countries"), while "employees" is implemented only as a listbox and you can also create a listbox for "region".
Furthermore, our example shows how to reset the department_id when an employee is deleted, just like you may want to reset "country_region_id" when a region is deleted.
I recommend that you analyze our example before proceeding further.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
viktor
Posted: 04/14/2004, 5:17 AM

Thanks for prompt reply.

1. Yes. I update database 'country'

2. I know I can make it working based on 'country' table only

3. I want to learn how to use 'custom insert/update/delete' using grid based on query / more the one table.

That is why I've taken this case as a sample.

So, why 'custom insert' works and 'custom update' and 'custom delete' does not work?

Where could I have made a mistake?

Thanks in advance.
peterr


Posts: 5971
Posted: 04/14/2004, 11:28 AM

viktor,
I don't know enough details to answer your question. Each case is different and could have different issues.
Especially:
1. All you wrote about the problem was "I've tried to do the same with 'Custom Update' and 'Custom Delete' and failed."
2. Some MySQL versions don't support multi-table updates. The MySQL manual states "Starting with MySQL 4.0.4, you can also perform UPDATE operations that cover multiple tables", also "Before MySQL 4.0.18, you needed the UPDATE privilege for all tables used in a multiple-table UPDATE".
3. Not every multi-table query is updateable.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.