DBNULL / NULL 'error' with null database

Results 1 to 2 of 2

Thread: DBNULL / NULL 'error' with null database

  1. #1
    Join Date
    Dec 1969

    Default DBNULL / NULL 'error' with null database

    Hi guys,<BR><BR>Im getting irked having to use isnull(fieldname, &#039;&#039;) in my stored procedures all the time because asp.net doesnt allow casting of nothing to string. eg:<BR><BR>if datareader("address") = &#039;&#039; then<BR> &#039;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&#039;s everywhere?<BR><BR>(SQL 2000)

  2. #2
    Join Date
    Dec 1969

    Default Use IsDbNull

    There is an IsDBNull method you can use, like:<BR><BR>If dataReaderObject.IsDBNull(i) then<BR> &#039;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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts