null

About the non-nullable types debate

I keep hearing people talk about how non-nullable reference types would solve so many bugs and make programming so much easier. Even the creator of null calls it his billion dollar mistake, and Spec# has introduced non-nullable types to combat this problem. EDIT: Ignore my comment about Spec#. I misunderstood how it works. EDIT 2: I m...

How to pass a Nullable<int> into a stored procedure... from F#?

I'm trying to call a stored procedure with an output parameter from F#, so I need to pass an int? value initialized to null. However, F# is resisting my attempts, saying that the object cannot be null. I've read up on the web as to why that is but my problem remains - I need to call that stored procedure. Has anyone got any ideas as to h...

How can i pass a null value for date in vb.net to sql stored procedure?

Hi guys, My application is asp.net with vb. In my page I have a textbox for passing date. If I didn't enter date and on clicking submit, I have to pass null value to the stored procedure. I tried following codes such as DBNull.Value and DateTime.MinValue. In that case instead of null ,"#12:00:00#" is passing. I have to pass Null. So can...

[F#] Nullable values do not get modified when passed into C# code by reference.

I have an F# variable defined as follows let id = new Nullable<int>() and I am passing it from F# into a C# function that takes a ref Nullable<int> and, subsequently, assigns it a value (it's basically stored procedure code auto-generated by Linq2Sql). Unfortunately, when the function call exits, my id variable still has no value (i....

How do I correctly cast an item in a DataSet when it can potentially be null?

I have a dataset being returned by a stored proc and one of the items in it can potentially be null. I'm trying to convert each row in the dataset to a strongly typed object but I can't seem to cast the null value properly. I've created a mock up of my scenario as follows: DataSet ds = new DataSet(); ds.Tables.Add(new DataTable()); ds....

How liberal should I be with NOT NULL columns?

I'm designing a database schema, and I'm wondering what criteria I should use for deciding whether each column should be nullable or not. Should I only mark as NOT NULL only those columns that absolutely must be filled out for a row to make any sense at all to my application? Or should I mark all columns that I intend to never be null...

What does/should NULL mean along with FK relationships - Database

I was experiencing a hard time creating FK relationships in my relational SQL database and after a brief discussion at work, we realized that we have nullable columns which were most likely contributing to the problem. I have always viewed NULL as meaning unassigned, not specified, blank, etc. and have really never seen a problem with t...

if (!this) { return false; }

I stumbled upon this piece of code this seems totaly broken to me, but it does happen that "this" is null. I just don't get how this can be null it is inside a normal method call such as myObject->func(); inside MyObject::func() we have if (!this) { return false; } is there any way I can have the first line to throw a NullPointer...

How can you check for null in a VBA DAO record set?

I have an optional field in a database that I'm pulling out using a DAO Record Set. I need to check whether or not the field is set before I concatenate it with other fields. So far I have the following code snippet which I've tried with both Is and = (that's the obviously wrong syntax [[Is | =]]) to no avail. It appears that if I use...

.NET 2.0 nullable types and database null musings

If .NET 2.0 nullable types was there from version 1, will DBNull.Value not be needed in the first place? Or RDBMS's null has no bearing with .NET's null? That is DBNull.Value will still be needed anyhow, regardless of .NET version 1 already have nullable types. ...

Accessing class members on a NULL pointer

I was experimenting with C++ and found the below code as very strange. class Foo{ public: virtual void say_virtual_hi(){ std::cout << "Virtual Hi"; } void say_hi() { std::cout << "Hi"; } }; int main(int argc, char** argv) { Foo* foo = 0; foo->say_hi(); // works well foo->say_virtual_hi(); // ...

Entlib Cache.Contains NULL problem

Hi, I have a combined authorization and menustructure system on our backend. For performance reasons EntLib caching is used in the frontend client (MVC rel 1.0 website, IIS 5.1 local, IIS 6.0 server, no cluster). Sometimes 'Cache.Contains' will return true, but the contents of the cache is NULL. I know for certain that I filled it corr...

How can I constrain multiple columns to prevent duplicates, but ignore null values?

Here's a little experiment I ran in an Oracle database (10g). Aside from (Oracle's) implementation convenience, I can't figure out why some insertions are accepted and others rejected. create table sandbox(a number(10,0), b number(10,0)); create unique index sandbox_idx on sandbox(a,b); insert into sandbox values (1,1); -- accepted ins...

When does a java object become non-null during construction?

Hi, Say you are creating a java object like so: SomeClass someObject = null; someObject = new SomeClass(); At what point does the someObject become non-null? Is it before the SomeClass() constructor runs or after? To clarify a little, say if another thread was to check if someObject was null while the SomeClass() constructor was hal...

Null value objects in NHibernate

I have a person entity containing an Address as a value object: public Person() { WithTable("Person"); Id(x => x.Id); Component<Address>(x => x.Address, a => { a.Map(x => x.Address1); a.Map(x => x.Address2); a.Map(x => x.Address3); a.Map(x => x.Town); a.Map(x => x.Postcode); }); } It states...

Looking for MISSING records

I'm a bit rusty when it comes to MS Access and I am hoping someone can help me out..... I have a list of all items that have been scanned (for purchase) by each store, by UPC for a one month period. I also have a particular group of UPC's that I want data for. What I want to get is the items that DIDN'T get scanned. Obviously, the it...

Altering a column: null to not null

I have a table that has several nullable integer columns. This is undesirable for several reasons, so I am looking to update all nulls to 0 and then set these columns to "NOT NULL." Aside from changing nulls to 0, data must be preserved. I am looking for the specific sql syntax to alter a column (call it ColumnA) to "not null." Assum...

Clojure nil vs Java null?

Forgive me if I'm being obtuse, but I'm a little bit confused by the documentation about nil in Clojure. It says: nil has the same value as Java null. Does this mean that they're the same thing or are they different somehow? And does a NullPointerException mean that a Java null was encountered or would I also get this if nil was ...

For a NULL pointer, should I use NULL or 0?

Duplicate Do you use NULL or 0 for pointers in C++? When dealing with NULL pointers one can do this if(ptr != NULL){ ... } or this if(ptr != 0){ ... } Are there reasons to prefer one over the other in C++? ...

Can an ASP.NET HttpRequest ever be null? How about CurrentExecutionFilePath?

We're getting an odd bug in a production server. We have a stack trace, but no line numbers, so I know the method where the bug is, but not the exact line. It's complaining of a "Object reference not set to an instance of an object." Something is null. After looking at the code, the only two potential culprits that I can see are the ...