Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what's in the recordset???

Status
Not open for further replies.

Smarty

Programmer
Apr 12, 2001
191
BE
I want to check if there is something in the recordset, but it always returns "3" (also the number of cols if this has anything to do with it).
How do i test if there is a record in the recordset?

Here is the code (that fails):
ssql = "select * from doelpunten where speeldag = " & request.form("speeldag") & " AND spelerid = " & request.form("doelpunt" & i)
response.write ssql
ploeg2 = conn.execute(ssql)
'-------------------------------------------
' CHECK IF THERE IS A RECORD IN RECORDSET
'-------------------------------------------
if ploeg2.count <> 0 then
'-------------------------------------------
ssql = &quot;update doelpunten set doelpunten = &quot; & ploeg2.fields(&quot;doelpunten&quot;) + 1 & &quot; where spelerid = &quot; & request.form(&quot;doelpunt&quot; & i) & &quot; AND speeldag = &quot; & request.form(&quot;speeldag&quot;)
else
ssql = &quot;insert into doelpunten values('&quot; & request.form(&quot;doelpunt&quot; & i) & &quot;','&quot; & request.form(&quot;speeldag&quot;) & &quot;','1')&quot;
end if
'response.write ssql
set setdp = conn.execute(ssql)
 
i think you should test if the 'pointer' in the recordset is bof or eof:

if not ploeg2.eof and not ploeg2.bof then
...
end if

br
Gerard
 
What DBMS are you using? I see possiblities for a trigger here. It looks like you are first testing if there is a record in the DOELPUNTEN table (thats GOALS for non-dutch readers), and then choose between an UPDATE or an INSERT.
So you can write a trigger that will create this child for you when you add a 'wedstrijd' (match).


br
Gerard
 
I have the following dbms:
<code>
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
if conn.State=1 then
conn.close
Conn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0; Data source=&quot; & Server.MapPath(&quot;voetbal.mdb&quot;)
else
Conn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0; Data source=&quot; & Server.MapPath(&quot;voetbal.mdb&quot;)
end if
</code>
AND it's returned that bof and eof are methods that are not supported by the ploeg2 object
 
Oke, so your ploeg2 is a variable, and not an object.
Change:
ploeg2 = conn.execute(ssql)

into:

Set ploeg2 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
ploeg2.Open ssql, conn

br
Gerard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top