**** Logic!

Results 1 to 5 of 5

Thread: **** Logic!

  1. #1
    Conrad Guest

    Default **** Logic!

    I am trying to see if a recordset has returned any records. <BR><BR>I tried this:<BR><BR> If obj_recordset.BOF OR obj_recordset.EOF Then<BR><BR>This will not work because I am looking for all instances. So I tried:<BR><BR> If obj_recordset.RecordCount &#060; 1 Then<BR><BR>But the recordcount will only return -1. So I tried this<BR><BR> If IsNull(obj_recordset.Fields("my_field") Then<BR><BR>This will not work if no records are returned. So I tried<BR><BR> If obj_recordset.RecordCount &#060; 0 Then<BR><BR>After all, -1 is less than zero. Appearantly IIS doesn&#039t think so. So I tried:<BR><BR> If obj_recordset.Fields("Username") &#060;&#062; "" Then<BR><BR>This returned an exception error.<BR><BR><BR>So...any Ideas?<BR><BR>Thanks.<BR><BR><BR>

  2. #2
    Sousa Guest

    Default RE: **** Logic!

    I use <BR> <BR> if qry.bof and qry.eof then<BR> "there are no records idiot"<BR> else<BR> "there are records idiot"<BR><BR> you used or, i think and is the solution to all of your problems<BR> <BR> when confronted with beer and vodka, OR beer or vodka. Which to you choose, both.

  3. #3
    Karl Guest

    Default RE: **** Logic!

    ASP is absolutely freakin&#039 HORRIBLE when it comes to handling OR&#039d or AND&#039d conditional statements...I don&#039t even want to try figuring out why it&#039s doing what it&#039s doing, &#039cuz chances are it shouldn&#039t be doing it anyways :)<BR><BR>But I didn&#039t post this for no reason, -1 is returned from your RecordCount because your RS curcor doesn&#039t support it. Use a richer cursor. Try setting your RS.CursorType = adOpenDynamic (if you don&#039t have adovbs.inc I have no idea what the # value is for that..)<BR>if you dunno how to explictly declare your RS...<BR><BR>Set rs = Server.CreateObject("ADODB.RecordSet")<BR>Rs.Curso rType = adOpenDynamic<BR>Rs.Open SQLQueryHere,Conn<BR><BR>of course I still dunno if your logic will work...and a richer cursortype will have performance impact (although you probably won&#039t notice it for a small site, or on a powerful webserver)<BR><BR>Now I&#039m pissed off again with ASP&#039s handling of conditions...<BR><BR>arrgg..<BR><BR>--<BR>Karl

  4. #4
    Join Date
    Dec 1969

    Default RE: **** Logic! YOU GUYS NEED TO RELAX

    Just add , 3, 3 after you connection like<BR><BR>rs.open Sql, conn, 3, 3<BR><BR>and all will be well<BR>

  5. #5
    Karl Guest

    Default RE: **** Logic! YOU GUYS NEED TO RELAX

    Of course, the locktype (the 2nd 3) is only useful if you are using native ADO instead of SQL....so you probably might as well just not put it. Also, the best solution would still be not to use a RecordCount at all (since it requires that richer cursor..)<BR><BR>And we really don&#039t need to relax...VBScript is just flat out weak, or stupid, under certain circumstances. And although I don&#039t except any programming language, let alone script, to be perfect, VBScript seems to have short-comings in some of the most basic logic-control and debugging.<BR><BR>--<BR>Karl

Posting Permissions

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