Not possible to delete an Record.

Talk about any other operations you need to implement: additions, updates etc.

Moderators: ne_moj, zewa, vadimako, ne_moj, zewa, vadimako

Daniel
Newbie
Newbie
Posts: 3
Joined: Feb 2nd, '17, 08:25

Not possible to delete an Record.

Postby Daniel » Feb 2nd, '17, 08:36

Hello,

If I try to delete a Record, i got the Error_Message "The deleting operation uncompleted! Record # 8".
Debug:

Code: Select all

Oracle sql: SELECT "ID", "NAME", "VORNAME", "ABTEILUNG", "EMAIL", "AKTIV" FROM (SELECT rownum as linenum, "ID", "NAME", "VORNAME", "ABTEILUNG", "EMAIL", "AKTIV" FROM (SELECT TBL_USER.ID, TBL_USER.NAME, TBL_USER.VORNAME, ABTEILUNG, EMAIL, AKTIV FROM TBL_USER WHERE 1=1 ORDER BY Name ASC, Vorname ASC) WHERE rownum <= 10) WHERE linenum >= 1


search sql (total: 4) SELECT TBL_USER.ID, TBL_USER.NAME, TBL_USER.VORNAME, ABTEILUNG, EMAIL, AKTIV FROM TBL_USER WHERE 1=1 ORDER BY Name ASC, Vorname ASC AND (rownum > 0 AND rownum <= 10) 

 
delete sql (total: 0) DELETE FROM TBL_USER WHERE ID IN ('-1' , '8' );


Oracle sql: SELECT "ID", "NAME", "VORNAME", "ABTEILUNG", "EMAIL", "AKTIV" FROM (SELECT rownum as linenum, "ID", "NAME", "VORNAME", "ABTEILUNG", "EMAIL", "AKTIV" FROM (SELECT TBL_USER.ID, TBL_USER.NAME, TBL_USER.VORNAME, ABTEILUNG, EMAIL, AKTIV FROM TBL_USER WHERE 1=1 ORDER BY Name ASC, Vorname ASC) WHERE rownum <= 10) WHERE linenum >= 1


search sql (total: 4) SELECT TBL_USER.ID, TBL_USER.NAME, TBL_USER.VORNAME, ABTEILUNG, EMAIL, AKTIV FROM TBL_USER WHERE 1=1 ORDER BY Name ASC, Vorname ASC AND (rownum > 0 AND rownum <= 10) 


Warnings:

1) Wrong parameter in []: Check this field carefully, it may be not a Primary Key!

 
POST: Array ( )

GET: Array ( [mode] => delete [rid] => 8 [sort_field] => 0 [sort_type] => ASC [page_size] => 10 [p] => 1 )

Code:

Code: Select all

 $sql = "SELECT
          TBL_USER.ID,
          TBL_USER.NAME,
          TBL_USER.VORNAME,           
          ABTEILUNG,
          EMAIL,
          AKTIV
       FROM TBL_USER";
   
  ##  *** set needed options
  $debug_mode =true;
  $messaging = true;
  $unique_prefix = ""; 
  $dgrid = new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);
$dg_encoding = "WE8MSWIN1252";
$dg_collation = "WE8MSWIN1252";
$dgrid->setEncoding($dg_encoding, $dg_collation);

  ##  *** set data source with needed options
  $default_order_field = 'Name,Vorname';
  $default_order_type = 'ASC';
  $dgrid->dataSource($db_conn, $sql, $default_order_field, $default_order_type);
  ##  *** set caption
  $dgrid->setCaption("Usermanagement");
$vm_columns = array(
 "AKTIV"=>array("header"=>"Aktiv", "type"=>"checkbox", "true_value"=>1, "false_value"=>0, "width"=>"10px", "req_type"=>"si", "title"=>"Aktiv"
    ),
 "NAME"=>array("header"=>"NAME", "center"=>"left", "width"=>"", "wrap"=>"nowrap"
    ),
  "VORNAME"=>array("header"=>"VORNAME", "center"=>"left", "width"=>"", "wrap"=>"nowrap"
    ),
  "ABTEILUNG"=>array("header"=>"ABTEILUNG", "align"=>"center", "width"=>"", "wrap"=>"nowrap"
     ),
  "EMAIL"=>array("header"=>"EMAIL", "align"=>"center", "width"=>"", "wrap"=>"nowrap")
    );
$dgrid->SetColumnsInViewMode($vm_columns);
$vm_table_properties = array("width"=>"50%","left"=>"5" );
$dgrid->SetViewModeTableProperties($vm_table_properties); 

$vm_columns1 = array(
 "AKTIV"=>array("header"=>"Aktiv", "type"=>"checkbox", "true_value"=>1, "false_value"=>0, "width"=>"10px", "title"=>"Aktiv","req_type"=>"si"
    ),
 "NAME"=>array("header"=>"NAME", "type"=>"Textbox" ,"align"=>"center", "width"=>"", "wrap"=>"nowrap"
    ),
 "VORNAME"=>array("header"=>"VORNAME", "type"=>"Textbox" ,"align"=>"center", "width"=>"", "wrap"=>"nowrap"
    ),
 "ABTEILUNG"=>array("header"=>"ABTEILUNG", "type"=>"Textbox" ,"align"=>"center", "width"=>"", "wrap"=>"nowrap"
     ),
  "EMAIL"=>array("header"=>"EMAIL",  "type"=>"Textbox" , "align"=>"center", "width"=>"210px", "wrap"=>"nowrap", "req_type"=>"se")
    );
$dgrid->SetColumnsInEditMode($vm_columns1);

   
  ##  ***  set settings for edit/details mode
  $table_name = "TBL_USER";
  $primary_key = "ID";
  $condition = "";
  $dgrid->setTableEdit($table_name, $primary_key, $condition);
  $dgrid->setAutoColumnsInEditMode(false);

 
$exporting_option = true;
$exporting_directory = "";
$dgrid->AllowExporting($exporting_option, $exporting_directory);
$exporting_types = array("excel"=>"true", "pdf"=>"true", "xml"=>"true");
$dgrid->AllowExportingTypes($exporting_types);
 
  ##  *** set debug mode & messaging options
  $dgrid->bind();       


Where is my fault ?
Thank you very much.

administrator
Site Admin
Site Admin
Posts: 5988
Joined: Jan 7th, '09, 23:18
Contact:

Re: Not possible to delete an Record.

Postby administrator » Feb 2nd, '17, 13:05

What version do you work with?
It seems the problem in SQL delete:
DELETE FROM TBL_USER WHERE ID IN ('-1' , '8' )

Try to run it directly on your query analyser, do you see any error?

Daniel
Newbie
Newbie
Posts: 3
Joined: Feb 2nd, '17, 08:25

Re: Not possible to delete an Record.

Postby Daniel » Feb 2nd, '17, 13:37

I use the Version 4.2.8 and an Oracle 10g Database.

If I copy and execute the SQL "DELETE FROM TBL_USER WHERE ID IN ('-1' , '8' )" in the query analyser it work fine and the dataset will be deleted.

ne_moj
Master
Master
Posts: 243
Joined: Jan 1st, '16, 14:11

Re: Not possible to delete an Record.

Postby ne_moj » Feb 3rd, '17, 07:35

Hello Daniel

Unfortunately, we do not provide support for the old version of the DataGrid.

administrator
Site Admin
Site Admin
Posts: 5988
Joined: Jan 7th, '09, 23:18
Contact:

Re: Not possible to delete an Record.

Postby administrator » Feb 3rd, '17, 07:37

It's strange.
You have to make a debug directly in DeleteRow() method - check what exactly happens there and why it doesn't work.

Daniel
Newbie
Newbie
Posts: 3
Joined: Feb 2nd, '17, 08:25

Re: Not possible to delete an Record.

Postby Daniel » Feb 3rd, '17, 09:44

Thank you for your Help.
I have found the issue.

I simple remove the ";"-sign in Line 3668 in File datagrid.class.php function DeleteRow().

Code: Select all

OLD
        $sql .= ";)";     
NEW
        $sql .= ")";     

I think the Oracle-Database make the difference.


Return to “Additional operations implementation”