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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to Interrogate Recordset - Can this be done?

Status
Not open for further replies.

Coder7

Programmer
Oct 29, 2002
224
US
I need assistance determining how to accomplish the following (if it can be done):

On an html table, for each row of data that was extracted from the SQL server database, the last displayed table column on the screen = the links to the functions that can be performed against that specific row of data (i.e. view, edit, delete).

The links that are available (i.e. view, edit, delete)for a specific row are determined based on whether or not the recordset row has children (i.e. if a row has a child attached to it in the recordset, the data in that row can only be viewed and cannot be edited or deleted).

Data example:

type typeseq owner ownerseq
c 1
a 1 c 1
r 1 a 1

I need to check 'type' and 'typeseq' for each row against every row in the recordset to see if the 'type' and 'typeseq' values are found in the 'owner' and 'owner seq' columns.

Example:
the row where type = c and typeseq = 1 has a child attached to it because its type and typeseq values are in the owner and ownerseq columns for type = a and typeseq = 1.

the row where type = r and typeseq = 1 has no children because there are no recordset rows whose owner = r and ownerseq = 1

I can define a boolean variable as switch to indicate whether a row has a child or not and then, by checking the value of the switch, I can determine which links are available for the data row in the html table.

Currently, which I think is very amateurish and inefficient, I display all possible links on each row and, on submit, I submit the page to itself and call a sub that executes a stored procedure to check for children.

Then, based on the query results (no rows returned = has no children), I either submit the page for further processing of the selected function or display an error message that the selected function is not available for that row of data because there is a child attached.

Thanks!!


 
Not sure if I follow but... when building the original html table etc., don't build a link element for actions that are not available for a given row.

-pete
 
Palbano,

I don't think I can do that with my initial query against the database. First I must pull off all rows where (i.e.) tx_id = 1.

Then when I'm on the client w/the resultant recordset I must determine which recordset rows have children and which ones don't.

If the row has a child attached I will display only a 'view' link. If the row has no children, I will display 'view', 'edit' and 'delete' links.

Does that make sense?
 
>> Does that make sense?

This part does not.

>> I don't think I can do that with my initial query
>> against the database.

Then you say this:

>> If the row has a child attached

Where did the attached child come from? Also provide a more detailed description of all these items like type, origin, relationships

-pete
 
Data example:

type typeseq owner ownerseq
c 1
a 1 c 1
r 1 a 1

I need to check 'type' and 'typeseq' for each row against every row in the recordset to see if the 'type' and 'typeseq' values are found in the 'owner' and 'owner seq' columns.

Example:
the row where type = c and typeseq = 1 has a child attached to it because its type and typeseq values are in the owner and ownerseq columns for type = a and typeseq = 1.

the row where type = r and typeseq = 1 has no children because there are no recordset rows whose owner = r and ownerseq = 1

 
Not so much with the copy paste. It looks like you are describing a single table with parent/child relationships using cross column binding. If that is correct then:

Try looking at ADODB.Recordset.find() and seek(). Leveraging the Recordset object you should be able to realize your information in a single server page build.

Good luck
-pete
 
I am sure that the best way to tackle this is to alter your initial query by adding a fifth column that identifies a cild present. I can't tell you how to do it without knowing the query and table structure, but I'm sure it can be done. -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top