|
-
Feb 25th, 2004, 09:44 AM
#1
Thread Starter
Member
Desperate help !!
Hiya Im really stuck on doing the multiple delete checkbox.. I would really appreciate if anyone could help me out. Basically I am doing on a datagid whereby it display all the customers particulars and users can choose to delete one or more customers by using the checkbox and finally click on the delete linkbutton.
I have a query, do i have to use dataset for this? Hope that someone can point out my mistake. Thankz...
Below is my coding:
Private Sub dgDelMember_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgDelMember.ItemCommand
Dim dgItem As DataGridItem
Dim dr As DataRow
Dim ds As New DataSet
Dim result As String
For Each dgItem In dgDelMember.Items
'Identify row in dataset to update
'dr = ds.Tables("Member").Rows.Find(dgDelMember.DataKeys(dgItem.ItemIndex))
If CType(dgItem.FindControl("chkMemDelete"), CheckBox).Checked And e.CommandName = "DeleteButton" Then
'ds.Tables("CustID").Rows.Remove(dr)
Dim conn As OleDbConnection
Dim objCmd As New OleDbCommand
Session("Chk_CustID") = CType(dgItem.FindControl("chkMemDelete"), CheckBox).Text
conn = connectToDB()
objCmd.CommandText = "spDelMembers"
objCmd.CommandType = CommandType.StoredProcedure
objCmd.Connection = conn
objCmd.Parameters.Add("@CustID", Session("Chk_CustID"))
' Execute SQL and read data from database
objCmd.ExecuteNonQuery()
' Bind the records to the data list control
dgDelMember.DataBind()
' Close the connection object
conn.Close()
End If
Next
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|