Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 2nd, 2005, 03:00 PM
Authorized User
 
Join Date: Nov 2004
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default Find() With multiple primary keys

I am having this problem with a delete function on a table with 3 Primary Keys. After spending some time on the internet, I found a few answers but I am still unable to get it to work. It is not throwing any errors but the row is getting no value with the following code:

If (Not (keys Is Nothing)) Then row = DataSet31.Tables(Table).Rows.Find(keys)

Here is the entire code snipit:

Private Sub PenXrefGrid_DeleteRowBatch(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles PenXrefGrid.DeleteRowBatch
        'Dim table As DataTable
        Dim table As String
        table = "tbl_Vet_Pen_Xref"
        Dim row As DataRow
        Dim keys(2) As Object
        'table = DataSet31.Tables(e.Row.Band.BaseTableName)

        keys(0) = e.Row.DataKey(0)
        keys(1) = e.Row.DataKey(1)
        keys(2) = e.Row.DataKey(2)

        'Try to find the row that needs to be deleted.
        If (Not (keys Is Nothing)) Then row = DataSet31.Tables(table).Rows.Find(keys)

        If (Not (row Is Nothing)) Then
            Try
                row.Delete()
            Catch
                DataSet31.RejectChanges()
            End Try
        End If
    End Sub

Any help?






Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Design: Foreign Key to Multiple Primary Keys? kalel_4444 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 10 May 8th, 2008 04:14 PM
When to define primary keys and foregin keys? method SQL Server 2000 1 August 26th, 2005 09:14 AM
ASP and auto-generated primary keys Steve777 Classic ASP Professional 2 May 26th, 2005 10:47 AM
Thoughts on Primary keys rohan_man Access 3 February 9th, 2005 06:18 PM
Subform/Links ~ Too Many Primary Keys fdsi19 Access 1 September 30th, 2003 12:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.