give all checkboxes same name ("delete")
For i = 1 To Request.Form("delete").Count
id = Request.Form("delete")(i)
...
Next
Edward
----- Original Message -----
From: "Travis D. Falls" <[EMAIL PROTECTED]>
To: "dotnet" <[EMAIL PROTECTED]>
Sent: Sunday, January 05, 2003 3:09 AM
Subject: I want to delete any permutation of a list
> I have a list that I am writing out. I this list is a form with the
> entries from a guestbook. I have a checkbox next each of the entries.
> The name of the checkboxes are "delete0", delete1", ect. They are built
> dynamically. I have a hidden field at the end that has numDelete = n
> what ever the total number of guestbook entries are. I want to call a
> submit function where I loop numDelete number of times, checking to see
> if I can get the delete0 or delete1, ect (if it is checked off) if it is
> I delete that entry. It isn't working and isn't throwing errors. Here
> is the function, can someone give me pointers?
>
> Sub submit(sender As Object, e As System.Web.UI.ImageClickEventArgs)
>
> Dim numDelete as int32
> numDelete =
> Integer.parse(Request.Form("numDelete").trim)
>
> Dim count as int32
> count = 0
> Dim deleteme as String
> Dim sqlString as String
>
> Dim objConnection As New
> System.Data.SqlClient.SqlConnection(connection info goes here)
>
> do while count > numDelete
> try
> deleteme = Request.form("delete" &
> count.toString).trim
> sqlString = "DELETE tblMessageBoard
> WHERE messageID =" & "'" & deleteme & "'"
> errors.text += sqlString & " "
>
> dim objCommand = new
> SqlCommand(sqlString, objConnection)
> objCommand.Connection.Open()
> objCommand.CommandType =
> CommandType.Text
> objCommand.ExecuteNonQuery()
> objCommand.Connection.Close()
>
> catch ee as Exception
> errors.text += ee.tostring + " " + count
> end try
>
> count = count + 1
> loop
>
> Dim url as String
> url =
> "http://www.unsygnedartist.com/loggedIn/bboardview.aspx"
> Response.Redirect(url)
> End Sub
>
>
> ---
> You are currently subscribed to dotnet as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
%%email.unsub%%
>
> ---------
> Administrated by 15 Seconds : http://www.15Seconds.com
> List Archives/Search : http://local.15Seconds.com/search
> Subscription Information : http://www.15seconds.com/listserv.htm
> Advertising Information: http://www.internet.com/mediakit/
>
>
>
---
You are currently subscribed to dotnet as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
---------
Administrated by 15 Seconds : http://www.15Seconds.com
List Archives/Search : http://local.15Seconds.com/search
Subscription Information : http://www.15seconds.com/listserv.htm
Advertising Information: http://www.internet.com/mediakit/