CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> Java

 Checkbox list issue pls help

Print topic Send  topic

Author Message

Posts: 3
Posted: 06/28/2013, 3:36 AM

hi, my problem is my checkbox list only save the last key of my selection, but im following the example pack of codecharge guide to do this, the result is the example pack in codecharge does not working. But the example given from internet ( is working!

this is the class for insert, update, and delete, this is copy from example pack of codecharge

class ProjectEmployeesModifyCheckboxList {   
final public void process(Page page, String mode) {   
String[] projectList = page.getHttpPostParameters().getParameterValues("ProjectList");   
long empId = 0;   
try {   
empId = Long.parseLong(DBTools.toSql(page.getHttpGetParameter("emp_id"),JDBCConnection.INTEGER, "CC5Ajax"));   
} catch (Exception e_ignore) {}   
if ( "Insert".equals(mode) ) { /  
/Retrieve the last inserted key   
//Use MS SQL method (disabled below)  
//String lastInsKey = DBTools.convertToString(   
// DBTools.dLookUp("@@IDENTITY", "employees", "", "IntranetDB"));   
//Use method compatible with all databases (unsafe when multiple users  
//insert records at the same time)   
String lastInsKey = Utils.convertToString( DBTools.dLookUp("max(emp_id)", "employees", "", "CC5Ajax"));   
//Insert New links   
if (projectList != null) {   
JDBCConnection conn = JDBCConnectionFactory.getJDBCConnection("CC5Ajax");  
 for(int i=0; i< projectList.length; i++) {   
String projectId = conn.toSql(projectList, JDBCConnection.INTEGER);   
conn.executeUpdate("INSERT INTO projects_employees (project_id, emp_id) VALUES (" + projectId + "," + lastInsKey + ")");   
} else if (empId > 0) {  
 JDBCConnection conn = JDBCConnectionFactory.getJDBCConnection("CC5Ajax");  
 if ("Delete".equals(mode) || "Update".equals(mode)) {  
 //Delete project employees links   
conn.executeUpdate("DELETE FROM projects_employees WHERE emp_id=" + empId);   
 if ("Update".equals(mode)) {   
//Insert assigned employees   
for(int i=0; i<projectList.length; i++) {   
String projectId = conn.toSql(projectList, JDBCConnection.INTEGER);   
conn.executeUpdate("INSERT INTO projects_employees (project_id, emp_id) VALUES (" + projectId + "," + empId + ")");   
} conn.closeConnection(); }  

String[] projectList = page.getHttpPostParameters().getParameterValues("ProjectList");
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

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

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