|
crosscreek -> Improving my add.asp page (3/11/2008 0:31:40)
|
I am trying to improve my asp page that will add dogs to my database. If someone submits a blank form then they get a "must type something in" If someone trys to add a duplicate, then gets "dog already in database" If they type in a dog's name that neither choices above then the dogs added. Now I am able to do the 1st two, but can't get the code to add the dog if the first two codes are false. This is that I have so far...Now I will fix it for SQL injection, I just want to get it to work first. Dim objrs, bolalreadyexists If Request.form("doggy") = "" OR Request.form("doggy") = " " Then Response.Write ("No Search Text Entered! YOu must type a name.") Response.Write ("<a href='adddog.htm'> Click to go back to the Add dog Page page") Else bolalreadyexists = false Set objrs = Server.CreateObject("ADODB.Recordset") objRS.open "tbldog", myConn, , adlockoptimistic, adcmdtable Do while not (objrs.eof OR bolalreadyexists) If (strcomp(LCase(objrs("name")), request.form("doggy"), vbBinaryCompare) = 0) then Response.write "This dog has already been entered. Please go back to enter a new dog in or click below to go to the pedigree page." Response.Write "<a href=""pedigree.asp?id="&objRS("ID")&""">" & objRS("name") & "</a>" bolalreadyexists = true End if objrs.movenext Loop If not bolalreadyexists then objRS.AddNew objRS("name") = Request.form("doggy") objRS.Update Response.write "you have added the dog" End if objrs.close set objrs = nothing End if myConn.close Set myConn = nothing HELP!
|
|
|
|