Select the value from a field of one table and place it into another table.

Using VB.NET, VS2005, SQL Server 2000.

In a Windows Form, how could I provide a means for a user to select the value from a field of one table (a primary key value) and place it into another table (as a foreign key value)?

The goal is to "assign" a person from one table to a location in another table by placing the person's primary key value into the location's foreign key field via an easy to use "selection" mechanism like a DataGridView or something.

Thanks in advance for any help or examples.

David 

0
megnin
3/23/2007 3:16:24 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

1 Replies
711 Views

Similar Articles

[PageSpeed] 48

this is an ASP.Net forum - -

you might want to check out:

http://forums.microsoft.com/msdn/default.aspx?forumgroupid=2&siteid=1


David Wier
MCP/ASPInsider
ASPNet101.com - where to look first!
Please Vote for ASPNet101 - 'Best Community Resource'!
Control Grouper - easily control properties for multiple controls with one control!
Calendar Express - The Best HTML Calendar Generator on the web!
(Please 'Mark as Answer' when it applies)
0
augustwind
3/23/2007 5:07:16 PM
Reply:

Similar Artilces:

DropDownList bound to one table, selected value from another table
I posted this in another forum topic and I'm not getting any response.  I'm hoping maybe I will ge more help here since it pertains to a server control.  Hi I am having a very frustrating problem with a DropDownList.  The DropDownList is bound to one SQL Server 2005 table.  I do this progromatically with the following code:Public Sub EvaltrID() TryDim aType As String = txtAircraftType.SelectedValue Dim auth As String = Convert.ToInt32(MinLevel.Text) Dim active As String = "True"Dim iPilot As String = "True" Dim CrewPos As Strin...

DropDownList bound to one table, selected value from another table
Hi I am having a very frustrating problem with a DropDownList.  The DropDownList is bound to one SQL Server 2005 table.  I do this progromatically with the following code:Public Sub EvaltrID() TryDim aType As String = txtAircraftType.SelectedValue Dim auth As String = Convert.ToInt32(MinLevel.Text) Dim active As String = "True" Dim iPilot As String = "True"Dim CrewPos As String = txtCrewPos.SelectedValue Dim CrewPos1 As String = "SO" Dim instructSO As String = "True"Dim sesType As String = txtSessionType.Text Dim sesType1 As String ...

CheckBoxList gets text from one table, send values to another table
I am working on making a CheckBoxList in a DetailsView that allows the user to check the boxes of the services they would like to receive. In my SQLDataSource, I have two tables that are involved in this. Columns "ServiceID" and "Name"are stored in one table, "Services," and the columns "UserID" and "ServiceID" are stored in another table, "UserServices." I want the CheckBoxList to grab the value and the name of all the services available and have a box for each with the name beside each box. Once the user clicks on each box they want and then click "Submit" I want all rows in table "Use...

insert multiple values from one table into one column from another table?
Hi, I'm attempting to create an insert statement that gets the values from multiple columns and insert them into one column from another table, is there a simple solution to do this?Here is something similar to what i'm wanting done, just it's not the correct way to do it, i want value1, value2 and value3 from one table to be combined and put into the value1 column of another table, what am i doing wrong? INSERT INTO tablename2 (value1 + value2 + value3)SELECT value1FROM tablename1 thanks in advance! INSERT INTO tablename2 (SELECT val1 + val2 + val3 FROM tabl...

Selecting value in one field then causes value in another field to be selected.
I have a web form which contains a date field, the date is populated using a DatePicker which is Javascript based. The form also has a drop down box containing 3 values. What I want to do is when a date has been selected that this will cause the dropdown list value to change to dated which is one of its 3 values. i.e. when the date field is not blank then the value will be selected in the dropdown. What I also want to happen is when the date has been selected and the dropdown value is dated then the date field and the dropdown field will be set to read only.Anyone any ideas how to this usin...

moving from one table to other table automatically for every 3 months by checking the paticular value of the table field
Hi   I am having a table called as status ,in that table one field is there i.e. currentstatus. the rows which are having currentstatus as "ticket closed",i want to move those rows into  other table called repository which is having same table structure as status table. I can do programatically. but is there any way for every 3 months system has to check and do this action means moving to repository table automatically?   Please help me.   Thanks. Hi, check http://msdn2.microsoft.com/en-us/library/aa902640(SQL.80).aspx is SQL2000 for 2005 check SSIS &nb...

Select values from one table based upon values in another...
How do I:Select f1, f2, f3, from tb1 where f1=Select f1 from tb2 where f1='condition'?Rex WinnCode-frog System Architects, Inc.VS 2005 Professional, C#, C++ Well... You might try reading up on some standard sql syntax... There are a number of different ways... Select t.f1,t.f2,t.f3 From tb1 t INNER JOIN tb2 t2 ON t.f1 = t2.f1 Where t2.f1 = 'condition'   Select t.f1,t.f2,t.f3 From tb1 t Where t.f1 IN (    Select t2.f1    From tb2 t2    where t2.f1 = 'condition')   Select t.f1,t.f2,t.f3 From tb1 t Where exists (select t2....

field value from one table to another
i have two tables (staff and documents). for each staff i create they will have a unique value to identity them. now i have a table to store their documents and i want to relate each staff with their document. so i have in staff table (staff_id, staff_name) and in documents (doc_id, staff_id, doc_name). the staff_id in staff table has auto increment but not in doucment table. i also specified foreign key relationship.but when i run application it gives me error: "Cannot insert the value NULL into column 'staff_id', table 'Emp.documents'; column does not allow nul...

can I compare one record from one table to another record in another table?
can I compare one record from one table to another record in another table? I need to test if this condition is met. My scenario is: i need to check one table for a value and compare it to a list of records. for example, table 1           columnrecord 1- applesrecord 2- orangesrecord 3- grapes table 2            col1   col2   col3    col4record 1- Null , Null, Null, grapes I need to compare table 2 records with a list of records from table 1. the fru...

CheckBoxList Databinding, Select from One Table, Insert Into another Table
Newbie here! I've looked all over the place to see if I find some code that can get me started with this project, here it goes guys, as usual, all help is appreciated... SQL Server, I have 1 table tblServices that shows all of the services we offer, with 3 fields, such as: ID, CategoryCode, CategoryDescription. When loading my web form I want to offer all of these service options showing them the "CategoryDescription" in a checkboxlist option for my users to click on, and then submit the form into a second table. The second table "tblEx...

select from one table, put into another, delete from original table
Hi there, i am writing a stock control system for a small company. Most of it has been done apart from the picking part. When the user (staff member in the shop) places an order for a customer, they type in the item ID they want + the qty and there is a DDL to say collection, delivery etc. There are 3 main tables involved tbl_stock - where stock information + pics are held tbl_location - where the location of stock is held, each row has 11 columns e.g. Item Name  Qty1  Location1  Qty2  Location2 etc up to 5. Each row is for one item, so for example if there is stockID 2...

How do i copy / insert a Primary Key value of one table into another table?
  Hi i have set up  two very simple tables, I want a user to be able to create a basic account ( data stored in User_Profile  table with Id set as the Primery Key as Identity) I want the user to be able to be able to return to their account at a later date and then post multiple reviews of different bands they have seen at a later date. I kept the tables in my example very simple so I could get my head around the concept, but generally, I want to connect the Id (PK) value in User_Profile table to the User_Id filed in the User_Review table, so every review th...

Getting information from one table and applying it to another table record.G
Hello, I'm creating a website in ASP.NET and C#, My problem is I want to add a new record to a table using data from another table. i.e. Add a book, to set the book category you have to select if from a databound dropdown in another table. All those categories are stored in a different table. I'm not sure how to do that. Any help is appreciated. Thanks a lot!! Gabriel do datasource copy in the server-side or javascript copy in the client-sideRichard Tsuei (Chikun Cui)Contact me via E-mail: ricktsuei@gmail.comWeblog: http://ricktsuei.cnblogs.com+-+-+-+-+-+-+-+-+-+-+-+-+-...

Copy values from one table to another table using LINQ to SQL?
Hello,I have two database tables that have different names but identical structure (columns).What is the easiest way to copy the values from one table to the other table using LINQ to SQL? Thanks,-- shawn shawn Hi, As far as I research, we could use "foreach"  to insert the data from one table to another table. The code is shown below.         //there exist two table list and listSecond        DataClassesDataContext dataClass = new DataClassesDataContext(); //create the instance of the DataCon...

Web resources about - Select the value from a field of one table and place it into another table. - asp.net.getting-started

A Bad Lip Reading of Star Wars
The Star Wars “week of frenzy” would not be complete without every video series trying their hand at the original trilogy. That includes the ...

How US rate hike affects Australia
THE most telegraphed US rate rise in history is expected to provoke bigger moves on financial markets than what’s been seen so far.

Pentagon chief Carter used personal email account at times, has stopped: statement
Reuters Pentagon chief Carter used personal email account at times, has stopped: statement Reuters WASHINGTON U.S. Defense Secretary Ash Carter ...

Top Google searches in 2015 show Aussies are really curious about Netflix
It was a year of real highs and lows for Aussies, if their 2015 Google searches are anything to go by. Netflix finally arrived Down Under, making ...

Skype for Business launches on Android
Skype for Business has launched on Android following months in the company’s preview program. Skype has designed the app to maximize productivity ...

Mistrial underscores prosecutors' tough task in Baltimore police cases
NBCNews.com Mistrial underscores prosecutors' tough task in Baltimore police cases Reuters NEW YORK A mistrial on Wednesday in the case of ...

Google says proposed DMV rules requiring steering wheel, pedals, and licensed drivers with special certification ...
Gabe Nelson / Automotive News Automaker : Google says proposed DMV rules requiring steering wheel, pedals, and licensed drivers with special ...

UN Set to Adopt Resolution to Disrupt Islamic State Funds
UN Security Council set to adopt resolution aimed at disrupting Islamic State group's funding

Microsoft aims to supply Chinese government with customized Windows 10
After signing a deal with China's answer to Google in September, Microsoft is again strengthening its position in the country, this time by providing ...

Moviegoers Still Feel Safe After Recent Terror Attacks: New Study
Terrorist attacks in Paris and San Bernardino, Calif., have become hot topics in the presidential race and dominated the media. Despite wide-spread ...

Resources last updated: 12/17/2015 8:44:41 AM