Subject: Validate ID
Posted By: Raul Post Date: 2/6/2004 5:06:01 PM
I need a function that when a user enters in a  Value like an Id the function check the database if there is already an existing ID. If so returns a message to the user. Anyone have any source code for this.





Reply By: Greg Griffiths Reply Date: 2/8/2004 8:17:16 AM
try something like :

set results=dbConn.execute("SELECT * FROM users WHERE user_id='" & Request.Form("userid") & "'")

if results.EOF
    'no match
else
    ' 1 or more matches
end if
Reply By: Raul Reply Date: 2/9/2004 7:05:49 PM
<%
Dim LPCommand1
Dim adExecuteNoRecords
Dim IngAdded    
Dim IngRecs
Dim ingexist


Set LPCommand1 = Server.CreateObject("ADODB.Command")
    With LPCommand1
         .ActiveConnection = conn
         .CommandText = "PANVLP_CodFabCheck"
         .CommandType = adCmdStoredProc
         
            'Create the parameters
            .Parameters.Append .CreateParameter ("RETURN_VALUE", adInteger, adParamReturnValue)
            .Parameters.Append .CreateParameter ("@Ps_CodFab", advarchar, adParamInput, 30, Request.Form("Ps_CodFab"))
            
            'Execute Stored Procedure    
            .Execute IngRecs, ,adExecuteNoRecords            
            ingexist = .Parameters("RETURN_VALUE")
    
    
    end with
Set LPCommand1 = nothing

Is there a way i can throw ingexist into some java function to fire the alert??? Or better yet for the java function to call this sp. You see I am using a submit button to post to another page that will do the processing I the the onsubmit it calls a java function that validates other things like empty fields and stuff I want it also to do this check. I know this is probaly simple for you gurus, but i am an asp novie.


Go to topic 9584

Return to index page 952
Return to index page 951
Return to index page 950
Return to index page 949
Return to index page 948
Return to index page 947
Return to index page 946
Return to index page 945
Return to index page 944
Return to index page 943