SELECT IIf something AS something?

Results 1 to 2 of 2

Thread: SELECT IIf something AS something?

  1. #1
    Martin Olsson Guest

    Default SELECT IIf something AS something?

    I&#039m having problems with getting the below statement to work when uploaded to the server. It works fine at home. Access 97 database, FILE DSN, IIS.<BR><BR>sqlCommand = "SELECT IIf(Max([ThreadPos])=NULL,1,Max([ThreadPos])+1)AS NewThreadPos FROM Message WHERE (((Message.PrevRef)=lngID));" <BR><BR>At home this returns the correct thread position (this is for a message forum, partially borrowed code). When uploaded it returns NULL.<BR><BR>Wny? Any settings in IIS? The database is identical.<BR><BR>Regards,<BR><BR>Martin Olsson<BR><BR>

  2. #2
    Martin Olsson Guest

    Default Threaded discussion woes part II

    I&#039ve been fiddling a bit and I&#039ve come to some sort of understanding as to what is going on, but no solution yet.<BR><BR>The SQL statement again:<BR><BR>SELECT IIf(Max([ThreadPos])=NULL,1,Max([ThreadPos])+1) <BR> AS NewThreadPos <BR> FROM Message <BR> WHERE (((Message.PrevRef)= " & lngID & "));"<BR><BR>The problem occurs when there is no match for the WHERE clause. No Message.PrevRef equals lngID.<BR><BR>On my "home" server running PWS 4 on NT 4 SP5 "NewThreadPos" contains the value "1" after execution.<BR><BR>On the "live" server (don&#039t know IIS version) it returns nothing.<BR><BR>Both servers have the same copy of the Access 97 database. I&#039m using file DSN.<BR><BR>I&#039ve been trying to work around it by doing something like this:<BR><BR>if RS.Fields("NewThreadPos") = NULL then <BR> intNewThreadPos = 1 <BR>end if<BR><BR>response.writing RS.Fields("NewThreadPos") gives nothing at all (NULL?), but the above IF condition is not met. <BR><BR>Any ideas as to what is going on?<BR><BR>Regards,<BR><BR>Martin Olsson

Posting Permissions

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