uws
|
| Posted: 07/07/2005, 4:07 PM |
|
hey guys i have a editable grid add/update /delete
i want to be abale to check box the delete witch i have .but before it delete's that line
i want in to insert in to a difrent talbe any ideas how to do or what the custom code would look like thanks
|
|
|
 |
DonB
|
| Posted: 07/07/2005, 7:41 PM |
|
Somewhat generally, the solution is to execute the query:
INSERT newtable SELECT * FROM oldtable WHERE <your criteria here>
Do that in the before execute delete. Thie SQL assumes that both tables
have the same columns in both count and name.
Or
INSERT newtable (col1, col2, col3) SELECT col1,col2,col3 FROM oldtable WHERE
<your criteria here>
if you want to pick certain columns and only insert them.
The syntax can vary slightly for various database implementations.
--
DonB
http://www.gotodon.com/ccbth
"uws" <uws@forum.codecharge> wrote in message
news:542cdb59947ca1@news.codecharge.com...
> hey guys i have a editable grid add/update /delete
> i want to be abale to check box the delete witch i have .but before it
delete's
> that line
> i want in to insert in to a difrent talbe any ideas how to do or what the
> custom code would look like thanks 
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
uws
Posts: 8
|
| Posted: 07/07/2005, 11:46 PM |
|
<your criteria here > kinda confused i'm new to php and codecharge can you explain // i want it to insert what ever line/id is checked
thanks
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/08/2005, 4:29 AM |
|
<your criteria here> can be copied from the original delete that is being generated.
If CCS generates: DELETE from TABLE where ID=xyz
then the part after the where is <your criteria here>
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
uws
Posts: 8
|
| Posted: 07/08/2005, 3:37 PM |
|
ok what am i doing wrong here is what i got // i know it's prob somthing really simple for you guys but like i said i'm new to this game thanks ..
<?php
//BindEvents Method @1-5C4B5898
function BindEvents()
{
global $inv;
$inv->ds->CCSEvents["BeforeExecuteDelete"] = "inv_ds_BeforeExecuteDelete";
}
//End BindEvents Method
//inv_ds_BeforeExecuteDelete @2-692E7314
function inv_ds_BeforeExecuteDelete()
{
$inv_ds_BeforeExecuteDelete = true;
//End inv_ds_BeforeExecuteDelete
//Custom Code @11-0C24B529
// -------------------------
global $inv;
// INSERT comp SELECT * FROM inv Where = "ID=" . $this->ToSQL($this->CachedColumns["ID"], ccsInteger);
// -------------------------
//End Custom Code
//Close inv_ds_BeforeExecuteDelete @2-370E52F4
return $inv_ds_BeforeExecuteDelete;
}
//End Close inv_ds_BeforeExecuteDelete
?>
|
 |
 |
Nicole
Posts: 586
|
| Posted: 07/09/2005, 6:16 AM |
|
You can try this code:
global $form_name;
global $DBconnection_name;
$DBConnection_name->query("INSERT comp SELECT * FROM inv Where ID=" . $DBConnection_name->ToSQL($form_name->ds->CachedColumns["ID"], ccsInteger));
_________________
Regards,
Nicole |
 |
 |
uws
Posts: 8
|
| Posted: 07/12/2005, 9:58 PM |
|
ok guys i'v spent over 14 hours and i just can't figure this out still not working // heres the last thing i tryed 
//Custom Code @54-0C24B529
// -------------------------
global $comp_ds;
global $inv_ds;
global $inv;
|
 |
 |
uws
Posts: 8
|
| Posted: 07/12/2005, 9:59 PM |
|
opps sorry here it is
//Custom Code @54-0C24B529
// -------------------------
global $comp_ds;
global $inv_ds;
global $inv;
// $inv_ds->query("INSERT comp SELECT * FROM inv Where ID=" . $inv_ds->ToSQL($test.php->ds->CachedColumns["ID"], ccsInteger));
//End Custom Code
|
 |
 |
peterr
Posts: 5971
|
| Posted: 07/13/2005, 12:56 AM |
|
Your code looks completely different from the solution proposed above. Use Nicole's code above.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
uws
Posts: 8
|
| Posted: 07/13/2005, 1:24 PM |
|
thanks to Nicole for the code and peter for verifing it works great .. peter i am new to this game if you would have read the entire post you would understand .my problem was that i left the forward slas// in what do they do ?? my final code looked like this and it works great thanks to all i know it's a simple thing for most of you but i have a big project and need to start with the basics to figure out code charge thanks agin to all that help on this one ..
//Custom Code @54-0C24B529
// -------------------------
global $DBConnection1;
global $inv;
$DBConnection1->query("INSERT comp SELECT * FROM inv Where ID=" . $DBConnection1->ToSQL($inv->ds->CachedColumns["ID"], ccsInteger));
|
 |
 |