|
| |
|
|
crosscreek
Posts: 107 Joined: 2/5/2008 Status: offline
|
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!
< Message edited by crosscreek -- 3/11/2008 1:18:22 >
|
|
|
|
crosscreek
Posts: 107 Joined: 2/5/2008 Status: offline
|
RE: Improving my add.asp page - 3/11/2008 1:50:35
quote:
Response.Write "<a href=""pedigree.asp?id="&objRS("ID")&""">" & objRS("name") & "</a>" For some reason it didn't like this. It's a hyperlink to the duplicated dog in the database. Once I took that out...worked great. Thanks Helena
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|