Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 6th, 2011, 09:18 AM
Registered User
Join Date: Feb 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADO design question

Hey guys,

I've got 2 tables...



now computer has a FK constraint from Motherboards PK so I can no longer do a simple insert without having the motherboard present. That all works correctly.

Now in my ADO I've got an insert statement on Computer which calls a stored proc. Should I pass all my variables to the Stored proc? and call internally other Stored procs from the main one?

Or should ADO be able to handle mapping? I'm confused how I can tell my ADO to insert into Motherboard first and then insert into Computer.
Reply With Quote
  #2 (permalink)  
Old February 13th, 2012, 05:53 AM
Registered User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2011
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post

you can pass all values to same procedure and using the values for motherboard table first insert the record and declare a variable to store the identity of the motherboard table that will be used in the computer's table


insert into motherboard (col1, col2, col3, ......)
values (@Para1, @Para2, @Para3,....)

Declare @ID

insert into computer (col1, col2, col3, .... , col_fk_motherboard)
values (@Para4, @Para5, @Para6, .... , @ID)

Akaas Developer
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question OF Design SP2010Dude BOOK: Beginning ASP.NET 4 : in C# and VB 6 September 17th, 2010 01:59 PM
design question androoo ADO.NET 1 November 13th, 2004 09:41 AM
Design Question flyin General .NET 4 July 21st, 2004 03:59 PM
Design question? qadeer05 SQL Server 2000 4 May 3rd, 2004 10:17 AM

All times are GMT -4. The time now is 01:08 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.