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 -> ASP

 Validate form entry against database tables

Print topic Send  topic

Author Message
mdkdue

Posts: 2
Posted: 11/23/2004, 2:07 AM

Hi
I want to do some simple validation on a form.
Users enter a customer code and email address into a simple record builder form to populate a table called epos_customers.
What i want to happen when they enter a customer code is for the code to be validated against customer codes in our 3 main databases. So, we have 3 databases called sys,sysg and sysu and each of these has its customer code details held in a table called customer.
When the users enters a customer code i want the validation to go off an check that the code DOES exist in one of the above databases and is a valid code.
If validation is succesful and the code exists the record is inserted into the epos_customers table, if it does not exist an error is displayed to say that this is not a valid customer code.

I hope i have explained everything clearly and really hope someone can help me.

Thanks
View profile  Send private message
dataobjx


Posts: 181
Posted: 11/23/2004, 5:09 AM

You need to Add Code to the OnValidate event for the record.

Then, using the CCDLookup Function perform call against each of the databases.

However, before you can do this, you'll need to ensure that you have a Database connection set up for all 3 or 4? databases involved in the project settings connection tab.

Assuming you have;
sysDB
sysgDB
sysuDB

Configured in the settings you'd do something like this in the OnValidate() event... you will need to modify it accordingly;

Dim lngID
Dim blnOK
Dim sResult

lngID = RECORDSETNAME.FIELD_CUST_NO.Value
blnOK = False

sResult = CCDLookup("FIELD_NAME", "TABLE_NAME", "id=" & CCToSQL(lngID, "Integer"), sysDB)
If Len(sResult) > 0 Then blnOK = True

If NOT blnOK Then
sResult = CCDLookup("FIELD_NAME", "TABLE_NAME", "id=" & CCToSQL(lngID, "Integer"), sysgDB)
If Len(sResult) > 0 Then blnOK = True
End If

If NOT blnOK Then
sResult = CCDLookup("FIELD_NAME", "TABLE_NAME", "id=" & CCToSQL(lngID, "Integer"), sysuDB)
If Len(sResult) > 0 Then blnOK = True
End If

'finally if blnOK is still false, - the customer doesn't exist in any of the databases.
If NOT blnOK Then
RECORDSETNAME.Errors.Error = "Unable to locate customer number."
End If





_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
mdkdue

Posts: 2
Posted: 11/23/2004, 6:08 AM

hmm,
thanks for your help but im really struggling here...im very new to this.
Things have changed also and i have decided to take a different approach.
Each of the three databases is a different country, sys=UK, sysg=DE (germany) and sysu=US
I think it would be easier to have some drop down boxes on the input form. The user could then
1. Select a country from the three choices.
2. This will then go of and read slcustm from the relevant sys database depending on the choice.
3. This then populates another drop down box with all the customer codes and names read from slcustm.
4. An email address can then be inputed and the entry entered into epos_customers.

I hope this is possible!!!

Many thanks
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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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