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

How to update a table while doing an insertion using dynamic data?

Status
Not open for further replies.

collegian

Programmer
Jul 1, 2010
64
US
Hello All,

I am new to dynamic data and .NET 3.5. I do not see any code behind files in the project. I was just wondering if there is any way to do some other functionality once I click on the Insert link button? Suppose,I need to update another table once insert is clicked, based on the values being inserted in first table.Is there any way to do it? Also,is there any way to access the values being inserted into the table? Please give some suggestions.


Thanks.
 
I assume you want the ID(identity column) of te row just inserted into the first table?

If so, use a stored procedure and return the identity just inserted. I am assuming you are using SQL Server, if so, then just return Scope_Identity()
 
Thanks for the reply.I apologize for having caused confusion but I don't want the ID of the row.I need the values corresponding to a column being inserted into the first table.Based on these values I need to fetch a set of values from another table and using those set of values I need to update a third table.

Also,where do I write this code? Should I create my own .cs file within the project?
 
I have never used that type of project. I write all the code myself which allows for greater flexibility.

I don't know what DB you are using. My suggestion is to used stored procedures (on the DB) if available.
 
Yeah,even I prefer to write my own code but in this case the code has already been written and I need to add to the existing functionality.

DB is SQLServer 2008.I can use stored procedures but the issue is how do I get hold of the data which is being inserted?
 
Not sure I understand your question.
If you are inserting the data to table1, you would pass in any values in parameters.
 
Well,I am new to using the dynamic data feature but the way it works is that I need to simply drag the tables from the database I will be working with, into the project and make some minor modifications.After this step I get all the functionalities such as insert,update,delete,edit automatically.
 
Like I said, I never used it. I would either code it myself or, in your case, use the entity framework.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top