Dear Experts,
I was trying to create an array of OleDbParameter using the following code snippet, but it gave me a NullReference Exception - "Object Reference not set to an instance of an object."
OleDbParameter [] params = new OleDbParameter[2];
SPparams[0].ParameterName = "BeginningDate";
SPparams[0].Value = Convert.ToDateTime("1/1/95");
But if I changed the above array declaration/creation statement to this, it works fine:
OleDbParameter [] params = {new OleDbParameter(), new OleDbParameter()};
My question is: Is the first-form not the correct way of declaring and creating an array? Pls. note that similar code has been used in msdn for illustrating the usage of CopyTo() method of OleDbParameterCollection class.
Thanks in advance.
Susmita
I was trying to create an array of OleDbParameter using the following code snippet, but it gave me a NullReference Exception - "Object Reference not set to an instance of an object."
OleDbParameter [] params = new OleDbParameter[2];
SPparams[0].ParameterName = "BeginningDate";
SPparams[0].Value = Convert.ToDateTime("1/1/95");
But if I changed the above array declaration/creation statement to this, it works fine:
OleDbParameter [] params = {new OleDbParameter(), new OleDbParameter()};
My question is: Is the first-form not the correct way of declaring and creating an array? Pls. note that similar code has been used in msdn for illustrating the usage of CopyTo() method of OleDbParameterCollection class.
Thanks in advance.
Susmita