|
-
Oct 18th, 2006, 01:25 PM
#1
Thread Starter
Hyperactive Member
[2005] assigning "null" to an item in a datarow?
Apparently this isn't how you do it
VB Code:
NewRow = TheTable.addrow
NewRow.Item(2) = DBNull 'this doesn't work
'and this parser shouldn't have used lastindexof apostrophe :P
so how do you stick a null value in there?
Last edited by Desolator144; Oct 18th, 2006 at 02:19 PM.
I tried to end process on Visual Studio 2005
but PETA stopped me saying it's smart enough
to be a living creature 
-
Oct 18th, 2006, 03:31 PM
#2
Frenzied Member
Re: [2005] assigning "null" to an item in a datarow?
-
Oct 18th, 2006, 03:34 PM
#3
Re: [2005] assigning "null" to an item in a datarow?
Umm, Shouldn't it be Nothing??
-
Oct 18th, 2006, 03:36 PM
#4
Frenzied Member
Re: [2005] assigning "null" to an item in a datarow?
potatoe patata. point is.. try different stuff
-
Oct 18th, 2006, 03:58 PM
#5
Thread Starter
Hyperactive Member
Re: [2005] assigning "null" to an item in a datarow?
the thing is, dbnull should have worked. I think if I assign it to nothing it will try to destroy that datarow.item object and I would try different things except I can't test this at all for reasons I won't get into cuz it's a loooong story so i need to make sure it's correct ahead of time
I tried to end process on Visual Studio 2005
but PETA stopped me saying it's smart enough
to be a living creature 
-
Oct 18th, 2006, 03:59 PM
#6
Frenzied Member
Re: [2005] assigning "null" to an item in a datarow?
well that sucks.. u can't like.. copy the file and use that one as a test file?
-
Oct 18th, 2006, 04:10 PM
#7
Thread Starter
Hyperactive Member
Re: [2005] assigning "null" to an item in a datarow?
does this look right?
VB Code:
Dim TheNull As DBNull
For x As Integer = 0 To tblQues.Rows.Count - 1
tblQues.Rows(x).Item(1) = TheNull
Next
cuz it's giving me the "that's a little iffy" squigglies :P
and I can't test it cuz I can't import a test from csv file into this database because I used my export test to make it and I don't want to double up tests cuz my management studio is broken (or more likely my mdf file) so I can't easily delete a whole new test cuz it spans 4 tables so I need to alter the csv file myself and import it into another copy of this database then toss that one if it works and make another copy of the original so my instructor can test the import without actually adding it to the original database. See told you it was complicated.
I tried to end process on Visual Studio 2005
but PETA stopped me saying it's smart enough
to be a living creature 
-
Oct 18th, 2006, 05:52 PM
#8
Re: [2005] assigning "null" to an item in a datarow?
DBNull is a class, so you can't just assign DBNull to a field. DBNull is the type of the object stored in a null field, not the value of the object.
VB Code:
tblQues.Rows(x).Item(1) = DBNull.Value
-
Oct 18th, 2006, 08:59 PM
#9
Thread Starter
Hyperactive Member
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
|