ASP and SQL Problem

Results 1 to 2 of 2

Thread: ASP and SQL Problem

  1. #1
    Jeff Boler Guest

    Default ASP and SQL Problem

    I want to create a button on my ASP that will delete a complete record in SQL. Any ideas?

  2. #2
    noa Guest

    Default RE: ASP and SQL Problem

    yes, basically you need to connect to the db, use an execute a temporary SQL statement to find the record you are looking for, then open up a recordset connection and delete it. so the code might look something like this:<BR><BR>Sub Delete(recordID)<BR>Set DataConn = Server.CreateObject("ADODB.Connection")<BR>DataCon n.ConnectionTimeout = 15<BR>DataConn.CommandTimeout = 30<BR>DataConn.Open "DSN=dsnName"<BR>set xConn = Server.CreateObject("ADODB.Connection")<BR>xConn.C ommandTimeout = 500 <BR>xConn.Open DataConn<BR>sqltemp="SELECT * FROM tablename WHERE ID =&#039" & recordID & "&#039;"<BR>set rstemp=xConn.execute(SQLTemp)<BR>Set xrs = Server.CreateObject("ADODB.Recordset")<BR>xrs.Open "tablename", xConn, 2, 3, 2<BR>xrs.delete<BR>xrs.update<BR>xrs.close<BR>set xrs = nothing <BR>rstemp.close<BR>set rstemp = nothing <BR>Set xConn = nothing<BR>DataConn.Close<BR>Set DataConn = Nothing<BR>end sub<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts