p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

asp_databases thread: problem with a delete in a DB

Message #1 by "Stef" <sne@s...> on Mon, 3 Jul 2000 14:47:7
Here is my problem, via another page and a formular, I give to my asp page 

a lot of infos to manage a DB on a sybase server; insert, update, view, all 

these actions work well, but 'delete' action don't work as i want. The 

second query in my code is effectively done, but i receive every time the 

message as the first query never be done :'deleted item not found, try 

again'. So it 's something like the second query is execute before the

first  one ... I try the queries independently, and they work well.

somebody has any idea ?

thanks for help


here is the code i use for my delete procedure:

Set conn = Server.CreateObject("ADODB.Connection")


connstring=connstring & "DSN=myserver;"

connstring=connstring & "Database=mydatabase;"

connstring=connstring & "UID=logininmaydb;"

connstring=connstring & "PWD=passwordformydb;"

conn.Open connstring 


	Case "delete"

		SQLquery="select id from mytable where ( trinome = '" & trinome & "' AND 

sport = '" & sport & "' )"

		rw(SQLquery) 'for debugging

		set result=conn.execute(SQLquery)

		rw(result.eof) ' for debugging

		if not result.eof then

		id = result.fields("id")

		set result = Nothing

		SQLquery="delete intra_sport where id = " & id 

		set result=conn.execute(SQLquery)


		rw("No more in DB with")

		rw("<br>Code = <b>" & trinome & "</b><br>sport = " & sport & "<br>")

		rw("Comment = " & comment )

		set result = Nothing


		rw("<b>deleted item not found, try again</b>")

		set result = Nothing

		end if

  Return to Index