How to determine if DataTable is null, not initialized

I have a method that does some work on a DataTable e.g. private void MyMethod(DataTable table) { if(table.Rows.Count > 0) { // do some work } } However, if the method receives a null datatable from the application it serves I get an 'Object reference

C # - How to use Regex to replace the NULL character?

I have the following string: < \0\"\0E\0x\0t\0e\0n\0s\0i\0b\0i\0l\0i\0t\0y\0,\0v\0e\0r\0s\0i\0o\0n\0=\0\\\0\"\07\0.\00\0.\03\03\00\00\0.\00\0\\\0\"\0,\0p\0u\0b\0l\0i\0c\0K\0e\0y\0T\0o\0k\0e\0n\0=\0\\\0\"\0B\00\03\0F\05\0F\07\0F\01\0

How to replace NULL /? with 'None' or '0' in r

DF1 is ID CompareID Distance 1 256 0 1 834 0 1 946 0 2 629 0 2 735 1 2 108 1 Expected output should be DF2 as below (Condition for generating DF2 -> In DF1, For any ID if 'Distance'==1, put the corresponding 'CompareID' into 'SimilarID' column, for '

How to use a table of another type of class?

I have declared a class named Member. I then assigned an array with Member type. When I try to put things into the array, it gives me this error: Exception in thread "main" java.lang.NullPointerException at HW2_2.main( This is my c

Delete a comment if the user does not exist Ruby on Rails

I get an error undefined method 'email' for nil:NilClass when I try to access a post with a comment from a user that has been deleted in the DB. I wonder: how can I remove the comments that has been created by users who no longer exists "on the fly&q

Combobox returns null when the value is typed

Sorry if it has some obvious solution, but I am trying to solve it for hours but could not find a solution. I use several ComboBoxes in my WindowsFormsApplication to relate ids with names. The problem is that when a user select an item from the combo

PHP - Adds a null character to a string

I'm trying to append a number of NULL characters '\0' to a string in PHP. $s = 'hello'; while(strlen($s) < 32) $s .= '\0'; However, PHP adds 2 characters (\ and 0), instead of escaping the character and adding NULL. Does anyone know to add a NULL cha

Why does not this string extension method throw an exception?

I've got a C# string extension method that should return an IEnumerable<int> of all the indexes of a substring within a string. It works perfectly for its intended purpose and the expected results are returned (as proven by one of my tests, although

SSIS empty int flat file fails in load

I have an SSIS package I am using to load a Fixed Width flat file. I have put in all the column lengths and have two packages against similar files working correctly. The third however keeps throwing the following error: [Source 1 [16860]] Error: Dat

How to determine if Json I received is empty

I have a function that receive a JObject, and in one case the Json that I receive are this: {} and I was trying to manage with this: public void GetSomeJson(JObject request) { if (request==JObject.Parse("{}")) throw new ArgumentNullException(&qu

Incompatible types: int and & lt; nulltype & gt;

I am having trouble with the (hashTable[bucket][size] == null). I was wondering how you could check to see that slot is null if null is not of type int. Any ideas/tips? public void add(int n){ int bucket = hashF(n); int p=0; int size = hashTable[0].l

returns NULL from a C ++ template

I have to create a template function that searches an element in a map variable. If the element exists, the function must return it. Otherwise i must return NULL. template <class K, class E> E dictionary<K,E>::research(K key){ //map<K,E>

How to find a null byte in a string in Python?

I'm having an issue parsing data after reading a file. What I'm doing is reading a binary file in and need to create a list of attributes from the read file all of the data in the file is terminated with a null byte. What I'm trying to do is find eve

The value of the string is null

I have a ListView with each row containing a TextView. On user click, I'm getting the value of the TextView and storing it in a String variable, and the user is navigated to another activity where he / she needs to input some data on said TextView. I

string initializing as NULL in C ++

string a=NULL; it gives error. Why and how can I initialize string as NULL? but when I write string a="foo"; this it works fine.Actually to get an empty std::string, you just write std::string a; std::string's default constructor will give you a

MySQL - query to return NULL

I have the following code: SELECT q25, ( ( AVG( q1 ) + AVG( q2 ) + AVG( q3 ) ) /3 ) AS Overall FROM t_results WHERE brand = 'XYZ' AND DATE = 'MAY2012' GROUP BY q25 ORDER BY Overall DESC LIMIT 1 If there is no data found by the query phpmyadmin return

Null substitution in SQLite:

In Sybase and MSSqlServer TransactSQL, we have a function IsNull(columnName,valueForNull) to return a typed default value when a column value is null. How can I replicate this functionality in SQLite? Example in TransactSQL: select IsNull(MyColumn,-1

Objects return null after presentModalViewController

After showing a camera, my objects return null: Here's how I show my UIImagePickerController (I initialize it before): [self presentModalViewController:pickerOne animated:NO]; I add a object in my scrollView like this, UIImageView *overlay = [[UIImag

Add null values ​​to a table

I have the this method: public function search($searchKey=null, $summary=null, $title=null, $authors=null, $paginationPage=0) { ... } And I'm trying to retrieve all parameters with this: $Class = new Search(); // Get parameters $ReflectionMethod = ne

Objective C: Why does not my NSMutableArray work?

I'm quite new to ObjC and its mutable arrays. This is driving me crazy ;-) I do the following: mColumns = [NSMutableArray array]; for( int i=0; i<5; i++ ) [mColumns addObject:[[MyColumn alloc] init]]; After that code my array "mColumns" conta

make the elements of a null array

are these two the same things? for(int i=0; i<array.length; i++){ array[i] = null; } and array = null; A small snippet to show the difference: // declare a array variable that can hold a reference. String [] array; // make it null, to indicate it doe