Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-09-04 : 08:26:51
|
| Darrell writes "I am new to SQL server and need help. I have two tables linked together in a one to many relationship. In VB I have created a select query to join the tables. When I enter data, the ID field value of the parent table is not being passed to the foreign key in the child table. How do I make this work? Is it a problem with setup in SQL server 2000 or my VB query? I know that access automatically passes the value with no problem. thanks and great site!Darrell" |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2003-09-04 : 08:51:41
|
| What are you trying to do? Select or Insert? Show us the query you're using.-------Moo. :) |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-09-04 : 20:58:42
|
quote: I know that access automatically passes the value with no problem.
That's exactly the problem, ACCESS is doing the work behind the scenes to insert the rows into the tables correctly. SQL Server does not have a user interface for this, it does exactly what you tell it to, and ONLY what you tell it to. You need to insert the parent row first, then use its key to insert the child(ren) row(s) into the related table(s).You can write a stored procedure to accept all of the values as parameters, and then perform the necessary insert operations. However, you cannot do this using any kind of bound controls like you'd have in Access. Any grids or other bound controls cannot have a data source set, you'd have to make them unbound, and then construct the stored procedure call using their values.You can get more guidelines on how to program this way by visiting some ASP sites. Web controls are by nature unbound, so this is the only method available in ASP apps. Some good sites are:http://www.4guysfromrolla.com/http://www.15seconds.com/http://www.asp101.com/http://www.aspalliance.com/http://www.learnasp.com/ |
 |
|
|
|
|
|