| | |
How do I Evaluate Null value from database?
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 20
Reputation:
Solved Threads: 5
The following can help you but i am sure whether this is the right way.
While selecting the column check for null values like
select ISNULL(class,-1) from student
If the column class contains null values,the query returns -1 value.
Using this value you can identity the column contains null value.
Good Luck.
While selecting the column check for null values like
select ISNULL(class,-1) from student
If the column class contains null values,the query returns -1 value.
Using this value you can identity the column contains null value.
Good Luck.
You need to compare the column value with System.DBNull.Value
So assuming a DataTable for example:
So assuming a DataTable for example:
ASP.NET Syntax (Toggle Plain Text)
if( myDataTable.Rows[0]["someColumn"].Equals(System.DBNull.Value) ) { //Handle situation for null value. }
Last edited by hollystyles; Mar 14th, 2008 at 5:59 am.
•
•
Join Date: Sep 2007
Posts: 86
Reputation:
Solved Threads: 1
Here is the code
ASP.NET Syntax (Toggle Plain Text)
[WebMethod] public int TestDBNullValue(string PID) { int ErrorValue = 0; if (PID.Equals(String.Empty)) { ErrorValue = 10110; //PID is null or empty } else { DeviceTableAdapter DeviceAdapter = new DeviceTableAdapter(); JeanPierre.DeviceDataTable DeviceTable = DeviceAdapter.GetDeviceUIDByPID(PID); if (DeviceTable.Count.Equals(0)) { ErrorValue = 1111; //No device found } else { JeanPierre.DeviceRow DevRows = DeviceTable[0]; if(DevRows.TrackingMode.Equals(System.DBNull.Value)) { ErrorValue = 1; } else { ErrorValue = 41; } } } return (ErrorValue); }
![]() |
Similar Threads
- jzkit z39.50 problem (Java)
Other Threads in the ASP.NET Forum
- Previous Thread: Assing sql query to gridview
- Next Thread: Database connectivity for sql server express edition 2005
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv gridview gudi iis javascript list listbox login menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers






