PDA

View Full Version : Validating Text field against database.


chandhseke
06-26-2009, 09:15 PM
I have a connection string which is wriiten in "Connection.asp", now i need to validate the text/number entered by requestors against a different database. Can anyone help me out in coding this..

<td bordercolor="#FFFFFF" bgcolor="#333399"> <div align="center"><font color=#FFFFFF size=2 face="Verdana, Arial, Helvetica, sans-serif"><strong>Emp_ ID</strong></font></div></td>
<td bordercolor="#FFFFFF"> <input maxlength=6 size=13 name=Emp_id/>

while the user/requestor enters thier Emp_id in the front end, it should validate against a different database..If the emp_id doesnt exists it shoud give a message "INVALID EMP_ID".

<%set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open = "Provider=sqloledb;Data Source=xxxxx;Initial Catalog=ABC;User Id=ABCDE;Password=;passwdd"
PS_SQL = "Select emp_id from employees where emp_id = '" & PS_ID & "'"
Response.Cookies("SQL") = PS_SQL
set rs1 = server.CreateObject("adodb.recordset")
set rs1 = Conn.Execute(PS_SQL) %>

If someone could help me out that will be much appreciated..Please edit the code or redo it for me as i have juat started my carreer and want to expertise things. Many thanks:confused:

tomws
06-26-2009, 10:45 PM
This is a double-fail of forum selection for your post. First, the second post in the forum plainly says: Sticky: WARNING: Questions posted here will be deleted!

Furthermore, this is ASP code - not Javascript at all.