CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Help with Editable Grid & Custom Update

Print topic Send  topic

Author Message
adams415

Posts: 5
Posted: 05/13/2014, 4:44 PM

I have an editable grid that uses custom SQL. It only allows you to update the table (not insert or delete). I've selected Table as the Custom Update Type and the table name in the Custom Update field.

Unfortunately, when I make an update it applies it to all of the rows. I am trying to configure the Condition type but am not sure how to define it.

I do have a primary key for the table. Any assistance is appreciated.


View profile  Send private message
ckroon

Posts: 869
Posted: 05/13/2014, 11:02 PM

Click your Editable Grid and then look at the Data Tab in the properties Window.

Custom Update Type should be : Table
Custom Update should have the table selected.. if it doesnt.. or you need to edit the WHERE statement click the three dots to the right of the Custom Update Box.

In the WHERE Box there should be a Where statement that limits to to each Row,

If you could let us see your Where statement it may help.

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
rho


Posts: 85
Posted: 05/14/2014, 1:41 AM

I understand from your post, that you don't want all the rows being submitted. A simple way to do this is to block the update event for the row(s) that you don't want submitted.

Add the following code to the BeforeExecuteUpdate() event of your Editable Grid:

$sender->DataSource->CmdExecution = $bUpdateRow;

where $bUpdateRow is your true/false condition that determines if the row should be updated.

Cheers, Rob.
View profile  Send private message
adams415

Posts: 5
Posted: 05/14/2014, 6:40 AM

Basically, that was my question... what should go into the Where table parameter...

If my table is something like:
cnum INT
classname varchar(200)
professor varchar(100)
asstprof varchar(100)

and the grid is displaying
classname, professor, and asstprof (cnum is a hidden field)

Should I use a parameter or and expression? I'm guessing an expression...

where cnum={cnum}

But when I try that I get these errors:
Warning: odbc_exec(): SQL error: [Microsoft][SQL Server Native Client 11.0]Syntax error, permission violation, or other nonspecific error, SQL state 37000 in SQLExecDirect in D:\inetpub\wwwroot\gen\db_odbc.php on line 93

Warning: odbc_binmode() expects parameter 1 to be resource, boolean given in D:\inetpub\wwwroot\gen\db_odbc.php on line 95

Database error: [Microsoft][SQL Server Native Client 11.0]Syntax error, permission violation, or other nonspecific error
View profile  Send private message
adams415

Posts: 5
Posted: 05/14/2014, 6:42 AM

rho - I don't want to edit one row and have it reset the value for all rows in the grid. Only the row that I edited. If I take out the custom sql, the editable grid works fine.

I've also tried to put my custom SQL into a view, but then I still need to reference the table and the result is the same...
View profile  Send private message
adams415

Posts: 5
Posted: 05/14/2014, 6:50 AM

ckroon- so my Where is currently blank (anything else throws errors).

In the parameters section is lists:

Field Names: classname, professor, and asstprof
Parameters Names: classname, professor, and asstprof
Field Type: Text for all 3
Parameter Type: Control
Blank for format & Do No Update Field if parameter is empty


thank for your your assistance...
View profile  Send private message
ckroon

Posts: 869
Posted: 05/14/2014, 10:48 AM

If cnum is your primary key then Where cnum={cnum} should work.. make sure its auto incremented.


_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
adams415

Posts: 5
Posted: 05/14/2014, 12:39 PM

Okay, it works...

What it took was to switch from TABLE to SQL.
It added an extra "WHERE" so that had to be removed.

It was also having issues with the primary key's data type so I refreshed the database connection.

thank you!
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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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