Hi,
I'm fairly new to ASP and I want to check a form input against my database to see if an entry with the same name already exists and have an if..then and else clause based on this.
I think I'm going about this the wrong way as I get an error when the database doesn't find a match.
This code works fine where there is already an entry in the database, but falls over on the if function when there is no match.
Any suggestions much appreciated
I'm fairly new to ASP and I want to check a form input against my database to see if an entry with the same name already exists and have an if..then and else clause based on this.
I think I'm going about this the wrong way as I get an error when the database doesn't find a match.
Code:
variable = Request.querystring("formname")
Set check = MyConn.Execute("select * from table where name='" & variable &"'")
if check("name")=variable then
response.write("I'm sorry, but the name you specified - " & check("name") & "already exists")
else
call function()
end if
Any suggestions much appreciated
Comment