Dim myArray(x) As string
myArray(0) = Trim(mid(strID,1,2))
myArray(1) = Trim(mid(strID,3,2))
myArray(2) = Trim(mid(strID,5,2))For CurrentNum = 0 to 2
stringSQL2 = "Select id,names from products where id='" & myArray(CurrentNum) & "'"
response.write (stringSQL2 & "<br>")
Conn = New SQLConnection(strConn)
Dim Cmd2 As New SQLCommand(stringSQL2,Conn)
Conn.Open
Rdr2 = Cmd2.ExecuteReader()
'While Rdr2.Read()
'Response.Write(Rdr2.Item("names") & "<br>")
'End While
myproducts.datasource = Rdr2
myproducts.databind()
Next
The datalist is as follows -
<asp:DataList id="myproducts" runat="server">
<itemtemplate>
<%# DataBinder.Eval ( Container.DataItem, "names" ) %>
</itemtemplate>
</asp:DataList
Thank you for any input
HBdatasources are not cummulative.
when you set a datasource and databind, the object clears what data it had and starts the binding process with a clean slate.
this means that you need to aggregate your data into a single list and then bind once.
0 comments:
Post a Comment