CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> Java

 Validate multicol primary key

Print topic Send  topic

Author Message
Ans

Posts: 53
Posted: 05/29/2006, 10:41 PM

Running jsp on MS SQL Server 2000. I place this code under the server event 'OnValidate'.
I have a table 'owner' with a pri key(deptID(int), modelID(int), para(char)).

Quote :
if (! e.getRecord().isEditMode() ||
! e.getPage().getHttpPostParameter("para", "").equals(e.getPage().getHttpGetParameter("para", "")) ||
! e.getPage().getHttpPostParameter("deptID", "0").equals(e.getPage().getHttpGetParameter("deptID", "0")) ||
! e.getPage().getHttpPostParameter("modelID", "0").equals(e.getPage().getHttpGetParameter("modelID", "0"))
) {
Object isUniqueValue = DBTools.dLookUp("deptID", "owner",
"para="+DBTools.toSql(e.getPage().getHttpGetParameter("para", ""),
JDBCConnection.TEXT,"testDB")+
" AND deptID="+DBTools.toSql(e.getPage().getHttpGetParameter("deptID", "0"),
JDBCConnection.INTEGER,"trestDB")+
" AND modelID="+DBTools.toSql(e.getPage().getHttpGetParameter("modelID", "0"),
JDBCConnection.INTEGER,"testDB"), "testDB");
if (isUniqueValue!=null) {
e.getRecord().addError("Combination already exits.");
}
}

I am trying to insert a check for a multiple primary key. I followed the example in CC, but it does not show my custom error msg but the complicated database error msg.

Is there anything wrong with my codes? Or do I have to activate other settings?
View profile  Send private message
mrachow


Posts: 509
Posted: 05/29/2006, 11:58 PM

I would suggest to first try your dLookUp w/o the if in front of it
_________________
Best regards,
Michael
View profile  Send private message
Nico
Posted: 06/28/2006, 1:27 AM

Quote :
,"trestDB"

>> First, I think you should write "testDB" instead of "trestDB" :-P

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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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