•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 374,173 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,445 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 932 | Replies: 15
![]() |
•
•
Join Date: Mar 2008
Posts: 20
Reputation:
Rep Power: 1
Solved Threads: 4
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.
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,161
Reputation:
Rep Power: 7
Solved Threads: 58
You need to compare the column value with System.DBNull.Value
So assuming a DataTable for example:
So assuming a DataTable for example:
if( myDataTable.Rows[0]["someColumn"].Equals(System.DBNull.Value) )
{
//Handle situation for null value.
} Last edited by hollystyles : Mar 14th, 2008 at 4:59 am.
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,161
Reputation:
Rep Power: 7
Solved Threads: 58
Hmm... well it works for me. You'll have to post some code or give more information.
•
•
Join Date: Sep 2007
Posts: 77
Reputation:
Rep Power: 1
Solved Threads: 1
Here is the code
[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);
}![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
age amd avatar backup blue gene breach business chips daniweb data data protection database development dos economy energy enterprise europe government hacker hardware hp ibm ibm. news intel ibm it linux medicine memory microsoft news open source openoffice pc ps3 recession red hat russia security server sql sun supercomputer supercomputing survey technology trends ubuntu working x86
- jzkit z39.50 problem (Java)
Other Threads in the ASP.NET Forum
- Previous Thread: ASP - Javascript connect to access Database
- Next Thread: web application



Linear Mode