Results 1 to 9 of 9

Thread: Can't Delete First Record...[RESOLVED - enough]

Threaded View

  1. #1

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Resolved Can't Delete First Record...[RESOLVED - enough]

    What am I missing? When I try to delete the first record (and only the first record) in my PostgreSQL DB, I get an error that says:

    An unhandled exception of type 'System.Data.DeletedRowInaccessibleException' occurred in system.data.dll

    Additional information: Deleted row information cannot be accessed through the row.


    VB Code:
    1. 'Public declarations
    2.  
    3.     Dim con As New Odbc.OdbcConnection
    4.     Dim ds As New DataSet
    5.     Dim da As Odbc.OdbcDataAdapter
    6.     Dim sql As String
    7.     Dim inc As Integer
    8.     Dim maxrows As Integer
    9.  
    10.  
    11. 'Form Load
    12.  
    13.     Private Sub PartsManager_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    14.  
    15.             con.ConnectionString = [LONG ODBC CONNECTION STRING IS HERE]
    16.  
    17.             con.Open()
    18.             sql = "SELECT * FROM customer ORDER BY customername ASC;"
    19.  
    20.             da = New Odbc.OdbcDataAdapter(sql, con)
    21.  
    22.             da.Fill(ds, "customer")
    23.  
    24.             maxrows = ds.Tables("Customer").Rows.Count
    25.  
    26.             inc = 0
    27.  
    28.             NavigateRecords()  'References another sub that tells where to put what, basically
    29.  
    30.     End Sub
    31.  
    32.  
    33. 'The Delete button code
    34.  
    35.     Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
    36.         Dim cb As New Odbc.OdbcCommandBuilder(da)
    37.         ds.Tables("customer").Rows(inc).Delete()
    38.         maxrows = maxrows - 1
    39.         inc = 0
    40.         NavigateRecords()
    41.         da.Update(ds, "customer")
    42.     End Sub

    Thanks in advance...Let me know if there's something else you need.
    CP
    Last edited by milkmood; May 11th, 2005 at 03:52 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width