Programming loops inside repeater controls

C

Chumley the Walrus

I'm trying to display groups of records with the repeater control in a
loop, whereas each time i iterate i will display the next set of
displaygroups. My sql,databind strings are :

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim strConn as string
="Provider=SQLOLEDB;SERVER=xxx.xx.xx.xxx;UID=sa;PWD=xxxxx;DATABASE=productcat;"
Dim strSQL as string ="select * from category where displaygroup = d"
Dim Conn as New OLEDBConnection(strConn)
Dim Cmd as New OLEDBCommand(strSQL,Conn)
Conn.Open()
thedata.DataSource =
Cmd.ExecuteReader(system.data.CommandBehavior.CloseConnection)
thedata.DataBind()
End Sub
</script>


I'm trying to loop thru the database until i run out of records:

<ASP:Repeater id="thedata" runat="server">
<itemtemplate><%dim d
d= 1
if thedata.databind() not eof then
d = d +1
end if
%>
<%# Container.DataItem("CName")%>

</ItemTemplate>
</ASP:Repeater>


...getting "Expression does not produce a value" error. The
thedata.databind() method is where i'm having problems
 
M

Marina

I think the problem is that 'if thedata.databind not eof then' is not a
valid if test. Meaning, that the conditions doesn't evaluate to true/false -
in fact, I'm not sure what the meaning of that is. The 'not' operator works
on single operands, to negate a boolean - it has no meaning with 2 operands.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top