<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=174583608-06092002><FONT face=Arial color=#0000ff size=2>i 
shall try this. i must say i'm very impressed at the help i've received so far 
on my queries. </FONT></SPAN></DIV>
<DIV><SPAN class=174583608-06092002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=174583608-06092002><FONT face=Arial color=#0000ff 
size=2>Trevor, the reason i've filled the my message outwith the if statement 
was just to check the sql was actually finding a record. </FONT></SPAN></DIV>
<DIV><SPAN class=174583608-06092002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=174583608-06092002><FONT face=Arial color=#0000ff size=2>I 
recollect an older version of VB where you had to go to the bof and eof to get 
the recordcount to work. But certainly in vb 6 you just use recordcount. Maybe 
something for future&nbsp;version of&nbsp;rev?</FONT></SPAN></DIV>
<DIV><SPAN class=174583608-06092002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV></DIV>
<DIV><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Tuviah 
Snyder [mailto:tuviah@runrev.com] <BR><B>Sent:</B> 05 September 2002 
18:48<BR><B>To:</B> use-revolution@lists.runrev.com<BR><B>Subject:</B> RE: Using 
a database cursor<BR><BR></DIV></FONT>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"><FONT face=Arial size=2>
  <DIV><BR>&gt;&nbsp; put "SELECT * FROM tblName WHERE tblName.Login = '" &amp; 
  field "login" &amp; "'"<BR>&gt;into&nbsp; strSql<BR>&gt;&nbsp; get 
  revdb_query(field "dbID",strSql)<BR>&gt;&nbsp; put "Welcome " &amp; 
  revdb_columnbyname(it,"fname") into field "MyMessage"<BR>&gt;&nbsp; 
  <BR>&gt;&nbsp; if revdb_recordcount(it) &lt;= 0 then<BR>&gt;&nbsp;&nbsp;&nbsp; 
  put "Sorry, no login for " &amp; field "login" &amp; " in the 
  database"<BR>&gt;&nbsp; else<BR>&gt;&nbsp;&nbsp;&nbsp; put "Welcome " &amp; 
  revdb_columnbyname(it,"fname") into field "MyMessage"<BR>&gt;&nbsp; end 
  if<BR>&gt;</DIV>
  <DIV>revdb_recordcount returns -1 for some databases (particularly MS Access), 
  this is a bug in&nbsp;the database&nbsp;itself. A workaround&nbsp;is 
  to&nbsp;fetch all the rows in the resultset until eof. RevDB does not&nbsp;do 
  this because it could be very expensive for huge resultsets.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>repeat while revdb_iseof(tcursor) is true</DIV>
  <DIV>&nbsp;&nbsp;&nbsp; add 1 to recordcount</DIV>
  <DIV>end repeat</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Below find a modified script</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>put "SELECT * FROM tblName WHERE tblName.Login = '" &amp; field "login" 
  &amp; "'" into&nbsp; strSql<BR>get revdb_query(field "dbID",strSql)<BR>put 
  "Welcome " &amp; revdb_columnbyname(it,"fname") into field "MyMessage"<BR>if 
  revdb_iseof(it) is true&nbsp;then</DIV>
  <DIV>put "Sorry, no login for " &amp; field "login" &amp; " in the database" 
  #first record is eof..resultset is empty&nbsp;</DIV>
  <DIV>&nbsp;else</DIV>
  <DIV>&nbsp; put "Welcome " &amp; revdb_columnbyname(it,"fname") into field 
  "MyMessage"</DIV>
  <DIV>&nbsp;end if<BR></DIV>
  <DIV>Tuviah Snyder &lt;<A 
  href="mailto:tuviah@runrev.com">tuviah@runrev.com</A>&gt; &lt;<A 
  href="http://www.runrev.com/">http://www.runrev.com/</A>&gt;<BR>Runtime 
  Revolution Limited - The Solution for Software 
Development</DIV></BLOCKQUOTE></FONT></BODY></HTML>