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

Dynamically Create 'helper' DB records? 1

Status
Not open for further replies.

roleki

Technical User
Sep 5, 2007
22
US
I hope somebody here can help me; I know how to *get* data out of a SQL DB, but I'm drawing a blank as to how to create/fill/mate them selectively...

My situation:

I've got a handful of ASP-based reports that use DataGrid controls to display the results of parameterized queries to our ERP system SQL database. These reports are reviewed in weekly staff meetings, and out of these meetings has come a request for the ability to make & save notes to each row of a given report.

It would seem to me the simplest way to do this would be to have a BoundColumn pointing to a 'comments' field in a database somewhere, then have an EditCommandColumn for each row to give people access to that field (setting the rest of the columns to ReadOnly)

The problem with that idea is, there *is* no 'comments' field available, and I cannot modify the ERP database at all, as it would void our service contract.

So my thought is, create an external table somewhere that consists solely of an ID field and a Comments field, then join that in the base query that yields the data for the DataGrid.

However... say I do come up with this blank table, with columns 'rID' & 'Comments'. How do I mate that blank table up to an existing table, but only fill it with records that HAVE comments (i.e., instead of create a blank comment record for EVERY record in the table, only populate the comment record when somebody MAKES a comment?)

I'm assuming it would be some kind of 'Click Edit, create comment, click save, rID is created, re-query the DB & re-display, now with comments associated with record' but I've run dry on how to actually DO that.

Am I really off base? Can anyone help?
 
What you are describing is why the LEFT JOIN operator was invented.

When you join records together, you usually get matching rows. However, if you LEFT JOIN 2 tables together, you will get matching rows if they exist or NULL values for those rows that do not exist.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top