View Single Post
  #9 (permalink)  
Old Oct 17th, 2004, 11:20
Monie Monie is offline
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Hai spinal....
I have this problem while executing the delete operation!
Can you look at my code PLEASE.....

THIS IS THE ERROR THAT I GET
Technical Information (for support personnel)

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/admin/ViewList_RegisteredLecturer.asp, line 8

Line 8 is the: viewLec.Open "DELETE * FROM userlist WHERE (username=" & record & ")"

HERE IS MY DATABASE CONNECTION
Code: Select all
<%
set viewLec = Server.CreateObject("ADODB.Recordset")
viewLec.ActiveConnection = MM_lecturer_STRING



For Each record In Request("Delete")
 viewLec.Open "DELETE * FROM userlist WHERE (username=" & record & ")" 
Next

viewLec.Source = "SELECT * FROM userlistSort"
viewLec.CursorType = 0
viewLec.CursorLocation = 2
viewLec.LockType = 3
viewLec.Open()
viewLec_numRows = 0
%>
Here is my full coding for displaying the userlistSort.mdb database query.
Code: Select all
<Form name="lecturer">
<table width="100%" bgcolor="#587698" style="border-collapse: collapse">
..
..
..
<% 
    While ((Repeat1__numRows <> 0) AND (NOT viewLec.EOF)) 
%>
        <tr bgcolor="#E6E6E6"> 
          <td width="44" bordercolor="#0D5692" height="1" align="center" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> 
            <div align="center"> 
              
	       <!--This is my checkbox button. I put at the beginning of each row. We set the value to be the unique data inside our database, can you tell me the purpose of this!
	       <input type="checkbox" name="delete" value="<%=(viewLec.Fields.Item("username").Value)%>">

            </div>
          </td>
          <td width="165" bordercolor="#0D5692" height="1" align="center" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> 
            <div align="center" style="width: 6; height: 0"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(viewLec.Fields.Item("fullname").Value)%></font></div>
          </td>
          <td width="129" bordercolor="#0D5692" height="1" align="center" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> 
            <div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(viewLec.Fields.Item("ID").Value)%></font></div>
          </td>
          <td width="162" bordercolor="#0D5692" height="1" align="center" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> 
            <div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(viewLec.Fields.Item("email").Value)%></font></div>
          </td>
          <td width="148" bordercolor="#0D5692" height="1" align="center" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> 
            <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(viewLec.Fields.Item("username").Value)%></font></td>
          <td width="161" bordercolor="#0D5692" height="1" align="center" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> 
            <div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(viewLec.Fields.Item("password").Value)%></font></div>
          </td>
          <td width="148" bordercolor="#0D5692" height="1" align="center" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> 
            
             
             ?delete=<%=(viewLec.Fields.Item("username").Value)%>">Delete Me![/b]</font>

	  </td>
        </tr>

<% 
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    viewLec.MoveNext()
    Wend
%>
      </table>

      <input type=submit value="Delete Selected Records">

</Form>
</body>
</html>

<%
viewLec.Close()
%>
Basically, the method that I used before this is like this:
when i click the delete button (at the end of each row), it will bring to another page where the delete operation will be done.

What I want to do now is, when i click the delete button, the selected row to be deleted will dissapear automatically without going to another page.
Can you help me with the problem that i am facing here.