index > SQL Server Everywhere Edition > Using resultset.IsDBNUll and getting error

Using resultset.IsDBNUll and getting error

I've got the statements:

if (rs.Read())
{
if (!rs.IsDBNull(endTimeColumnOrdinal))
{ tsDuration = rs.GetDateTime(3) - rs.GetDateTime(2); }
else
{ // other stuff goes here }
}

But this chokes on the call to the function rs.IsDBNull(), with the error: "No data exists for the row/column".

So what is the proper way to check for the possibility of it being NULL, if not that method? Seems like that is what it is there for.

Thanks!
-Dana

dana_lotus

Dana,

IsDBNull is indeed the proper way to see if a null value exists in a column with the DataReader and ResultSet. Are you sure that the ordinal you are providing for your check is within the bounds of your SELECT statement used when you executed the reader? I don't see anything obviously wrong with your code.

Darren




.NET Compact Framework MVP
Darren Shaffer
reply 2

You can use google to search for other answers

 

More Articles

• Compact Sql Mobile 3.0 DataBase in C++/OLE DB ?
• SQL Mobile support for CE 4.2
• Production Version
• Windows Mobile 5 connecting to SQL Server 2005
• Can I use SQL_Mobile as PC desktop server or PC local cache serve...
• MSDN about CeSetDatabaseInfo (EDB) info
• @@IDENTITY in code
• rda.push error
• sqlCeReplication.HostName size limit fix?
• Data Source error?
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Error when "SELECT" statement
• Merge Replication IIS Worker Process Error
• fastest way to do large amounts of updates
• Sos..
• How to open sdf file(2.0) with sql serve
• DB_E_ROWSNOTRELEASED ADO2.81 Recodset-&
• Microsoft SQL Server Mobile Edition data
• Bulk import data to SQL Mobile
• rda localconnection
• sql select
• Insert GUID into SQL Mobile Database tab
• Import data to SQL Server Mobile
• Cannot find PInvoke DLL SqlCeMe30.dll
• Test deploying WinForms app with SQL/e
• Reg:Error in PULL (RDA) for data sync

Hot Articles

• GUID in Mobile SQL
• Accessing Mobile SQL Databases in VB2005
• SqlCeConnection guidelines - keep it open?
• Error in Synchronizing Data
• SQL 2005 Mobile vs .NET CF 2.0 SP1?
• Use SQL Server Mobile on your Desktop (c
• genral network error on .net framework 1
• SQL Mobile 2005 NVarChar Truncation Prob
• Replication with filter
• Bulk Insert performance
• SQL Server Everywhere OLE DB sample
• Problem Creating a subscription
• Synchronize SQL Mobile 2005 using Active
• Filter using a combobox
• Remote synchronise from PDA to SQL Serve

Recommend Articles

• SQL CE Minor Error 25020
• Top Instruccion
• sqlev maintenance utility
• Loading data in SQL Mobile 2005 from the
• RDA Pull with existing table
• Copy SQL Server 2005 DB to SQL Server Mo
• HostName and ReinitializeSubscription
• Using Select In Push Command
• SQL Mobile 2005 NVarChar Truncation Prob
• How to make synchronize once instead of
• SQL Server Mobile - Reset Increment
• SQL CE 2.0: Calling Engine.Dispose() aft
• Synchronizing Data Within SQLCE and SQL
• General network error. Check your networ
• Can I use SQL_Mobile as PC desktop serve