Deleting Records - PowerPoint PPT Presentation

About This Presentation
Title:

Deleting Records

Description:

Title: Slide 1 Author: Murat Duran Last modified by: a Created Date: 12/28/2001 7:49:09 AM Document presentation format: On-screen Show Company: Murat Duran – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 5
Provided by: Mura49
Category:
Tags: cstr | deleting | records

less

Transcript and Presenter's Notes

Title: Deleting Records


1
Deleting Records
Action of the form item (checkbox) ?
deldatadb.asp ltinput type"checkbox" name"lt
rs1("stuID") gt" value"sil"gt
2
Deleting Records (1st way)
  • lt
  • set connsis Server.CreateObject("ADODB.Connectio
    n")
  • connsis.Open("DRIVERMicrosoft Access Driver
    (.mdb) DBQ" Server.MapPath("dbase/sis
    .mdb"))
  • Set rs1 server. CreateObject("ADODB.Recordset"
    )
  • Set rs2 server. CreateObject("ADODB.Recordset"
    )
  • SQL1 "select FROM student"
  • rs1.Open SQL1, connsis, 0, 1
  • do while not rs1.eof
  • id rs1("stuID")
  • idcstr(id)
  • if request.form(id) "sil" then
  • SQL2 "DELETE FROM student WHERE stuID "
    id
  • rs2.Open SQL2, connsis, 0, 1
  • end if
  • rs1.MoveNext
  • loop
  • rs1.Close

deldatadb.asp
3
Deleting Records
  • ltDim XFor Each X in Request.Form   
    Response.Write X " " Request.Form( X
    )Nextgt
  • The For Each X in Request.Form line will run
    through all the inputs in the form. X will in
    turn equal each input name (stuName, stuSurname,
    stuGender, stuYBirth)
  • So in the first loop when XstuName",
    Request.Form( X ) is
  • Request.Form( stuName" ) which will retrieve
    the value entered in the stuName inputbox.
  • The Response.Write X " " Request.Form( X )
    line will write X (the name of the input), an
    equal sign, and the value (the data enter by the
    user.)

4
Deleting Records (2nd way)
  • lt
  • set connsis Server.CreateObject("ADODB.Connectio
    n")
  • connsis.Open("DRIVERMicrosoft Access Driver
    (.mdb) DBQ" Server.MapPath("dbase/sis
    .mdb"))
  • Set rs1 server. CreateObject("ADODB.Recordset")
  • for each j in request.form
  • if request.form(j) "sil" then
  • sq1 "DELETE FROM student WHERE stuID " j
  • rs1.Open sq1, connsis, 0, 1
  • end if
  • next
  • set rs1 Nothing
  • connsis.Close
  • Set connsis Nothing
  • gt
Write a Comment
User Comments (0)
About PowerShow.com