How to set null values in dataset ?
-
I am having one column whose datatype is datetime . so how to set null values in that column ? when I am passing null values its throwing some error as it is getting initialised to'01/01001' can anyone help me out? thanks
You don't say what your data access library is. If you're using classic ADO editing a Recordset, just set the value to Null. This also applies to calling a stored procedure or substituting parameters in command text: set the appropriate Parameter to Null. From C++, you would use a variant with the vt member set to
VT_NULL
. If you're editing aDataTable
with ADO.NET, you can use the DataRow object's SetNull method, or you can assign the appropriate columnDBNull.Value
. -
You don't say what your data access library is. If you're using classic ADO editing a Recordset, just set the value to Null. This also applies to calling a stored procedure or substituting parameters in command text: set the appropriate Parameter to Null. From C++, you would use a variant with the vt member set to
VT_NULL
. If you're editing aDataTable
with ADO.NET, you can use the DataRow object's SetNull method, or you can assign the appropriate columnDBNull.Value
.hi , thanks for a prompt reply. I am editing a DataTable ,In that datatable I am having one datacolumn of datatype Datetime .so when I am setting the value DBNull.Value it's throwing null exception. I have tried with setnull method of datarow also but that method is not accessible. can you please help me out ?