ADODB.Field error ' 80020009' (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


hdreamz -> ADODB.Field error ' 80020009' (11/3/2002 7:54:07)

<%
dim Conn1, cql1
cql1=" SELECT Category FROM cat WHERE Channel=' Automobiles' ;"
set Conn1=Server.CreateObject(" ADODB.Recordset" )
Conn1.Open cql1, " DSN=eau"
%>
<table border=" 0" cellpadding=" 0" cellspacing=" 0" width=" 100%" >

<%
Do While NOT Conn1.EOF
%>
<tr>
<td width=" 50%" ><img border=" 0" src=" ../../img/but-gr.gif" >
<font face=" Arial, helvetica" size=" 2" ><%=Conn1(" Category" )%></font></td>
<%
Conn1.MoveNext
%>
<td width=" 50%" ><img border=" 0" src=" ../../img/but-gr.gif" >
<font face=" Arial, helvetica" size=" 2" ><%=Conn1(" Category" )%></font><font size=" 2" ></font></td>
</tr>
<%
Conn1.MoveNext
%>
<%
loop
Conn1.Close
set Conn1=nothing
%>

</table>

The above is my code and its creating the result as displaying 5 results.
but in the end it goes to result number six (there are only 5 matching records) and gives message

" ADODB.Field error ' 80020009'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

? "

could some one help please





Seventh -> RE: ADODB.Field error ' 80020009' (11/3/2002 8:14:21)

Welcome to OutFront, hdreamz!

These should help you out. It seems that this is a pretty common error.

#1. p2p.wrox.com

#2. Microsoft Knowledge Base - ASP




hdreamz -> RE: ADODB.Field error ' 80020009' (11/3/2002 12:47:17)

[:(]
that doest help. i got the problem... but i need solution.

the results is in this form:

Record 1 Record 2
Record 3 Record 4
Record 5 ERROR MESSAGE HERE

could some one help me please.





Spooky -> RE: ADODB.Field error ' 80020009' (11/3/2002 13:55:37)

Im not sure why you want to Conn1.MoveNext twice?
This should suffice:
<% 
Do While NOT Conn1.EOF 
%> 
<tr> 
<td width=" 50%" ><img border=" 0"  src=" ../../img/but-gr.gif" > 
<font face=" Arial, helvetica"  size=" 2" ><%=Conn1(" Category" )%></font></td> 
<% 
Conn1.MoveNext 
%> 
<% 
loop 




hdreamz -> RE: ADODB.Field error ' 80020009' (11/4/2002 3:12:33)

u see am displaying results not in one row.

i want results in two rows
its like this

1 ... 2
3 ... 4
5

like that. ofcourse in a table.

how to do that?




rdouglass -> RE: ADODB.Field error ' 80020009' (11/4/2002 14:41:36)

Haven' t tested this code specifically, but I' ve done things like that many times. This is how I' d do it....

<% 
dim Conn1, cql1, t
cql1=" SELECT Category FROM cat WHERE Channel=' Automobiles' ;"  
set Conn1=Server.CreateObject(" ADODB.Recordset" ) 
Conn1.Open cql1, " DSN=eau"  
t = 0

' Check for no records
IF  Conn1.eof THEN
   response.write " Your ID does not match any entries.<br>Please report the following:<br>"  & cql1 & " <br>To the database administrator..." 
	Conn1.close
	set Conn1=nothing
ELSE
%> 
<table border=" 0"  cellpadding=" 0"  cellspacing=" 0"  width=" 100%" ><tr>
<%
DO WHILE NOT Conn1.EOF%>

<td width=" 50%" ><img border=" 0"  src=" ../../img/but-gr.gif" > 
<font face=" Arial, helvetica"  size=" 2" ><%=Conn1(" Category" )%></font></td>

<%
	t = t + 1
	IF t=2 THEN
		Response.Write(" </tr><tr>" )
		t = 0
	END IF
LOOP

	' Fill last table cell if necessary
	IF t = 1 THEN
		Response.Write(" <td> </td></tr>" )
	ELSE
		Response.Write(" </tr>" )
	END IF

Conn1.close
set Conn1=nothing
END IF
%>


Hope it helps...

EDIT: Typo' s




hdreamz -> RE: ADODB.Field error ' 80020009' (11/5/2002 3:17:53)

hi rdouglass
thanks for responding.... BUT

your solution lists in one column.

what i want is results in TWO COLUMNS, never mind how many rows... but it should be in 2 columns.

can u please help me for this with above code. please..

say there are matching 5 records. then it should display as
quote:


1 2
3 4
5

ofcourse that in a table.

thanks in advance




rdouglass -> RE: ADODB.Field error ' 80020009' (11/5/2002 8:09:06)

Actually, if you look closely at the code, it does do two columns. If you look at the variable " t" and follow it thru, you' ll see that it starts with 0. We then start a row (<tr>) and write a column. Then add 1 to " t" . Then write another column, then add another 1 to " t" (" t" now = 2). Then:

IF t=2 THEN
Response.Write(" </tr><tr>" )
t = 0
END IF


If " t = 2" then close the row and start another row. The code after " LOOP" checks to see if there is only 1 column drawn. If there is only 1 column, then write another blank column and close the row. If " t <> 1" then just close the row.

Did you follow that??

This method does work and I use it quite often. Give it a try - I' m quite confident its what you' re looking for.....




g-john -> RE: ADODB.Field error ' 80020009' (11/27/2002 8:17:16)

hi rdouglass

ok it worked thanks...

BUT AGAIN...

could u guide me for 3 column style... i tried myself.. but failed. i guess once u show me 3 column way.. i will be able to do more.




rdouglass -> RE: ADODB.Field error ' 80020009' (11/27/2002 9:03:45)

Basically you would change your column width (<td width=" 33%" >) and change the check for ' t' to

IF t=3 THEN

Also, you' ll have to alter the ' filler' code to something like:

IF t = 1 THEN
Response.Write(" <td> </td><td> </td></tr>" )
ELSE
IF t = 2 THEN
Response.Write(" <td> </td></tr>" )
ELSE
Response.Write(" </tr>" )
END IF
END IF

(If you do many columns, you may want to build a loop in place of the IF...THEN' s)

Essentially ' t' is the number of columns. Does that help?




g-john -> RE: ADODB.Field error ' 80020009' (11/27/2002 9:40:30)

quote:

(If you do many columns, you may want to build a loop in place of the IF...THEN' s)


could you pls show with example for loop if many columns.





rdouglass -> RE: ADODB.Field error ' 80020009' (11/27/2002 10:22:53)

Based on the code above, you could do something like this:

Add 2 variables to the DIM line; something like:

DIM Conn1, cql1, t, numberOfColumns, filler

Then set your column count and filler variables; let' s use 4:

numberOfColumns = 4 ' change to number of columns desired
filler = " "

Then we would change the fillup code so that we check ' t' to see when it equals number of columns:

IF t=numberOfColumns THEN

Then we' d use ' fillers' like so:

FOR x = t TO numberOfColumns
filler = filler & " <td>&nbsp;</td>"
NEXT

Response.write(filler & " </tr>" & vbcrlf)

The code that I posted above would now look something like:

<%
DIM Conn1, cql1, t, numberOfColumns, filler
cql1=" SELECT Category FROM cat WHERE Channel=' Automobiles' ;" 

set Conn1=Server.CreateObject(" ADODB.Recordset" )
Conn1.Open cql1, " DSN=eau" 
t = 0
numberOfColumns = 4
filler = " " 

' Check for no records
IF  Conn1.eof THEN
response.write " Your ID does not match any entries.<br>Please report the following:<br>"  & cql1 & " <br>To the database administrator..." 
Conn1.close
set Conn1=nothing

ELSE  %>

   <table border=" 0"  cellpadding=" 0"  cellspacing=" 0"  width=" 100%" ><tr>

<%
DO WHILE NOT Conn1.EOF%>

<td width=" 50%" ><img border=" 0"  src=" ../../img/but-gr.gif" >
<font face=" Arial, helvetica"  size=" 2" ><%=Conn1(" Category" )%></font></td>

<%
t = t + 1

IF t=numberOfColumns THEN
Response.Write(" </tr><tr>" )
t = 0
END IF
LOOP

' Fill last table cell(s) where necessary
IF t=0 THEN 
t=4
END IF

FOR x = t TO numberOfColumns
filler = filler & " <td>&nbsp;</td>" 
NEXT

Response.write(filler & " </tr>"  & vbcrlf)

Conn1.close
set Conn1=nothing  END IF  %>




vinod -> RE: ADODB.Field error ' 80020009' (12/14/2004 19:03:37)

Try This



dim Conn1, cql1
cql1=" SELECT Category FROM cat WHERE Channel=' Automobiles' ;"
set Conn1=Server.CreateObject(" ADODB.Recordset" )
Conn1.Open cql1, " DSN=eau"
%>
<table border=" 0" cellpadding=" 0" cellspacing=" 0" width=" 100%" >

<%
Do While NOT Conn1.EOF
%>
<tr>
<td width=" 50%" ><img border=" 0" src=" ../../img/but-gr.gif" >
<font face=" Arial, helvetica" size=" 2" ><%=Conn1(" Category" )%></font></td>
<%
Conn1.MoveNext
%>
<td width=" 50%" ><img border=" 0" src=" ../../img/but-gr.gif" >
<font face=" Arial, helvetica" size=" 2" ><%=Conn1(" Category" )%></font><font size=" 2" ></font></td>
</tr>
<%
IF not Conn1.EOF then
Conn1.MoveNext
End if
%>
<%
loop
Conn1.Close
set Conn1=nothing




rdouglass -> RE: ADODB.Field error ' 80020009' (12/15/2004 9:21:39)

Hi vinod and Welcome to Outfront.

Is this a question or just a comment? If question, can you rephrase it? ..for this is a 2 year old post and I suspect it has been resolved. [;)]




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
9.570313E-02