Saqib Khan
asked on
ASP DELETE Statement
Hi, Can anyone on this earth Help me out with this code pleaseeeeeeeeeeeeeee, whats wrong with this code why my Delete statment is not working( Please ignore the &_ to continue the code in below example)
Dim conn
Set conn = Server.Createobject("ADODB .CONNECTIO N")
conn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\Inetpub\wwwroot\dma 110\final\ final.mdb"
dim sql
sql = "DELETE * FROM about WHERE fname="&Request.QueryStrin g("removee ")
conn.execute(sql)
%>
Dim conn
Set conn = Server.Createobject("ADODB
conn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\Inetpub\wwwroot\dma
dim sql
sql = "DELETE * FROM about WHERE fname="&Request.QueryStrin
conn.execute(sql)
%>
Also make sure Request.QueryString("remov ee") actually does have value.
hongjun
hongjun
ASKER
Hurrayyyyyyy it worked.. Please Can u Explain it to me About that Quoating things i would really Appericate that.And Also a little Brief Explaination for this code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
give points to hongjun:
Dim conn 'this will declare our variable.. a good practice 4 faster performance
Set conn = Server.Createobject("ADODB .Connectio n") 'creating the connection object
conn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\ww wroot\dma1 10\final\f inal.mdb;" 'opening the connection to the database and specifying the connection string
dim sql 'declaring
sql = "DELETE FROM about WHERE fname= '" & replace(Request.QueryStrin g("removee "),"'","'' ") & "'" 'query string to run against database
conn.execute(sql) 'querying the databse
'cleaning part
conn.close 'closing the connection
set conn = nothing ' destroying the connection object
%>
about replacing the single quote, single quotes are delimiters in SQL (the language), so we double them '' as an escape sequence otherwise if the value of our variable contains O'connor it will throw an error (this site has a similar replace now otherwise it would throw me the error when i post this message)
Dim conn 'this will declare our variable.. a good practice 4 faster performance
Set conn = Server.Createobject("ADODB
conn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\ww
dim sql 'declaring
sql = "DELETE FROM about WHERE fname= '" & replace(Request.QueryStrin
conn.execute(sql) 'querying the databse
'cleaning part
conn.close 'closing the connection
set conn = nothing ' destroying the connection object
%>
about replacing the single quote, single quotes are delimiters in SQL (the language), so we double them '' as an escape sequence otherwise if the value of our variable contains O'connor it will throw an error (this site has a similar replace now otherwise it would throw me the error when i post this message)
Dim conn
Set conn = Server.Createobject("ADODB
conn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\ww
dim sql
sql = "DELETE FROM about WHERE fname= '" & replace(Request.QueryStrin
conn.execute(sql)
conn.close
set conn = nothing
%>
hongjun