Hi all :)

Before i'm starting futher more about my problem. lets me tell a short description about my program.

user will choose path ID (retrieve all this data from table TPATH of database SDO) that they want to delete.

before the path ID would be delete, it will compare this path ID from table TTENS of database SDO and table TPATH of database SDO where this two table share the same column namely as M_C and also share the same database.

Capture4.PNG

this comparing method was write in Stored Procedure(SP).

this SP will be called on this class name as Path.vb :

Public Function getComparedPathID(ByVal DeletePathID As String) As DataSet
            Dim DHHConn As New DRConnection("", "DHH_CONN")
            Dim ds As DataSet
            Dim lsPath As String = ""
            Dim row As DataRow
            Dim intLoop As Integer = 1

            Try
                ds = DHHConn.RunSPReturnDS("sp_Path_ID", New SqlParameter("@M_C", DeletePathID))
                If ds IsNot Nothing Then 
                    If ds.Tables.Count > 0 Then
                        If ds.Tables(0).Rows.Count > 0 Then 
                            For Each row In ds.Tables(0).Rows
                                If intLoop = 1 Then
                                    lsPath = lsPath + row(0).ToString()
                                Else
                                    lsPath = lsPath + "," + row(0).ToString()
                                End If
                                intLoop = intLoop + 1
                            Next
                        End If
                    End If
                End If
                Return ds
            Catch ex As Exception
                LogManager.WriteLog(ex.Message)
                Throw New Exception(ex.Message)
            Finally
                DHHConn.CloseConnection()
            End Try
        End Function

And, on my path.aspx.vb page, this control button delete function :

Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click
            Dim i As Integer
            Dim result As DataSet
            Dim hypID As HyperLink
            Dim chkRemove As New CheckBox
            Dim clsPath As New Path()
            Try
                For i = 0 To grdPath.Rows.Count - 1
                    chkRemove = DirectCast(grdPath.Rows(i).FindControl("chkRemove"), CheckBox)
                    hypID = DirectCast(grdPath.Rows(i).FindControl("hypID"), HyperLink)
                    If chkRemove.Checked Then
                        result = clsPath.getComparedPathID(chkRemove.Text)
                    End If
                Next i
                lblErrorMessage.Text = "Paths delete successfully."
                BindGrid("%", "%", drpArea.SelectedValue, drpType.SelectedValue)
            Catch ex As Exception
                lblErrorMessage.Text = ex.Message
            End Try
        End Sub

And now, my Stored Procedure code that i used :

    CREATE PROCEDURE [dbo].[sp_Path_ID] @M_C varchar(20)
    AS
    BEGIN
        SELECT M_C FROM [dbo].[TPATH]
        WHERE M_C  NOT IN (SELECT M_RTE_C FROM [dbo].[TTENS])
        and M_C = @M_C
    END

My problem now :

i'm not be able to compare this data.
Are my SP is correct? If not, you have any suggestion how to create it?

Thank you for your kind to help me !