Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > I can find it, why can't my code?

Reply
Thread Tools

I can find it, why can't my code?

 
 
PaulNaude
Guest
Posts: n/a
 
      10-12-2005
I have a problem deleting a record from a table with 3 primary keys, in code.
I get the values of the primary keys from my datagrid displaying the record
to be deleted as follows:
....
findTheseVals(0) = DataGrid4.Item(u, 0) 'First column and unique primary key
(no duplicates allowed)
findTheseVals(1) = DataGrid4.Item(u, 1) 'Second column and primary key
(duplicates ok)
findTheseVals(2) = DataGrid4.Item(u, 2) 'Third column and primary key
(duplicates ok)
....

Then, to delete the record from the table, I use

DataSet11.Tables("Equipment").Rows.Find(findTheseV als).Delete()

but get the following error:

An unhandled exception of type 'System.NullReferenceException' occurred in
App.exe
Additional information: Object reference not set to an instance of an object.

i.e. this record was not found, although I can physically see it in the table.

I checked the populated values of findTheseVals and it matches my primary
key values (and types) in the database table exactly.
The column orders in the dataAdapter, datagrid and database table are
identical.
I checked that the table referenced is exactly the same as the one
referenced by the datagrid etc.

When I manually delete the row from my datagrid, the record is correctly
deleted from the database.

What am I missing here?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to exclude action of Find::Find::find in subdirectories withknown names? vdvorkin Perl Misc 0 02-10-2011 05:18 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
can find ImageButton but can't find button ad ASP .Net 2 11-20-2005 11:35 AM
Find.find does not find orphaned links? Wybo Dekker Ruby 1 11-15-2005 02:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57