ArrennaRef
New Member
Hi guys,<BR><BR>Im getting irked having to use isnull(fieldname, '') in my stored procedures all the time because asp.net doesnt allow casting of nothing to string. eg:<BR><BR>if datareader("address") = '' then<BR> 'this would throw an error if the address was null<BR>end if<BR><BR><BR>Is there a quick and dirty way around it or do i have to stick to using isnull's everywhere?<BR><BR>(SQL 2000)There is an IsDBNull method you can use, like:<BR><BR>If dataReaderObject.IsDBNull(i) then<BR> 'Object is null<BR>End If<BR><BR>where i is the index of the column in the current row (remember that the first column is the 0th column!)<BR><BR>See ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemDataSqlClientSqlDataReaderClassIsDBNull Topic.htm for the technical docs.<BR><BR>hth!