473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Multiple tables not displayed when binding to a Repeater

I have a page that takes a comma delimited string and needs to bind to a
Repeater control. The string is split into an Array, and each value is put
into a DataBase query via a For Each loop. The purpose is to retrieve
address information for the user. Sometimes, the address_fk field in the
people table is null, so there will be no linking address information. In
this case, the section to be displayed asks if the user would like to create
an address. (The section information is not shown.)

If the first array variable contains an id with an associated address, no
problem - the page acts correctly. The problem I have is that if the first
variable passed does not retrieve any rows from the address table, then the
second query (which does have values in the address table) is not displayed.
The If clause in the Page_Load event below is to retrieve the People ID
field, which must be shown in the Repeater section whether there is an
associated address or not.

I have verified that all works as I think it should up until the DataBind
method. Right before I bind to the Repeater, the row count is correct (0,2
respectively), and the table count is correct (2). But when I bind, only the
first row (no address data) is displayed. The Repeater only fires once, and
never fires for the second DataSet table, the one with values. What is
happening here?

(In the If clause, I clear the columns in the table because certain controls
in the Repeater are hidden based on the number of rows returned. If one row
is returned, it checks to see if there is one column (no address
information) or nine columns (there is address info.) If you need to see
further information, please let me know.)

Thank you very much,
Jim

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Session("myVars") = "46,44"

'Split the array
strArray = Session("myVars").ToString.Split(",")

'Declare database variables
objConn = New OleDbConnection(Application("dbString"))
objComm = New OleDbCommand(strSQL, objConn)
objDS = New DataSet()
objConn.Open()

'Loop through the addresses of each party
For Each strTemp In strArray
strSQL = "select
ad.id,name,Address1,Address2,City,State_ID_Fk,Zip_ Code,pa.id as
PeopleID,pa.id_number " _
& "from Address ad, People_Address pa where pa.id_number =
ad.ID_Number " _
& "and pa.id = " & strTemp

objAdp = New OleDbDataAdapter(strSQL, objConn)
objAdp.Fill(objDS, strTemp)

'If there are no rows, then repopulate with a new query
because the Repeater
'needs to have rows to work with
If objDS.Tables(strTemp).Rows.Count = 0 Then
strSQL = "select id_number from caseflow.people_address
where " _
& "address_fk is null and id = " & strTemp
objAdp.SelectCommand.CommandText = strSQL
objDS.Tables(strTemp).Columns.Clear()
objAdp.Fill(objDS.Tables(strTemp))
End If
Next

Response.Write("<br>My count = " & objDS.Tables.Count)
Repeater1.DataSource = objDS
Repeater1.DataBind()
End If
End Sub
Nov 17 '05 #1
0 2811

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: .Net Newbie | last post by:
I am relatively new to .Net and have been coding an intranet site for my employer for a couple of months. I am currently stuck coding in a text-editor called EditPlus without access to the VS.Net...
2
by: Donald Williamson | last post by:
I have a DataReader that I am binding to a Repeater control. In the DataReader, I have two fields: 'Name1' and 'Name2' 'Name1' will always have a person's name. Name2 periodically has a person's...
2
by: Simon Harris | last post by:
Hi All, I have an app which requires a list of coutries to be displayed, so far I have a datagrid which contains displays the countries Ok, along with flag images, these are also links to my...
2
by: Antoine | last post by:
I would like to construct my own list of items in a grid/ table/ item list layout but I have a problem. I want to add a sort of index row based on time, such as there might be blank values. Sure...
3
by: Maverick | last post by:
Assume i have 2 tables stored in a single dataSet (ds) and the relationship is well added ds.Tables("product") ds.Tables("descriptors") what I want to do is show the data from 2 of the tables,...
3
by: TJS | last post by:
is there a way to have multiple footer rows before the paging control in a datagrid ?
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
1
by: nina297 | last post by:
Hello, I'm a newbie to .NET. Could someone please assist me. I am pulling topics, questions and answers from a database. I've set all of this code in the code behind page which works. I have...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.