C# ASP.NET DataGrid and UID

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an interesting problem. I need to create a page that has a few text
boxes for info like name, address, etc. Also on that page will be a
datagrid that allows for dynamic insert (via footer). The data from the
datagrid will be in tblActivities and the info (name, address, etc.) will be
in tblForm. I need to relate this data. I figure I should insert a blank
record into tblForm upon page load and return @@identity from an identity
column. I could then use this identity val for updating data (name,
address, etc.) in tblForm when the submit btn is clicked. I could also use
this identity val for the foreign key in tblActivities when inserts from the
datagrid occur. This sounds like it'll work and relate the data between the
tables, however, a few concerns. What if a user opens the page, doesnt do
anything, then closes the page by simply closing the browser... a blank
empty record will now be in tblForm. There are also other concerns. Know
what I mean? How would you recommend I accomplish this so that I can have a
form with an auto number as well as a datagrid on the page that allows for
inserts? I'd appreciate any feedbback. Thanks a lot.
 
One solution...

If you use Guid's as your primary key, you can build your relationships
OUTSIDE of the tsql, and then ship in the all the info and relationships
...via something like Xml.

Your approach has a bad orphan implication, if the user doesn't go through
with the update. Aka "the cancel button".

...

You can also get by with IDENTITY's, if you wire up the tsql correctly.

You need to define your database entities a little clear. Explain the issue
from the db side of things.... What are the entities, and what are the
relationships...
 

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

Back
Top