inserting data from one table to another table..

Hi Guys!

 I am stuck on inserting data. Hope you will help me.

I have two tables name Customer and Address;

Customer(cust_id,name,add_fk);    fk=foreign key,  cust_id and add_id are primary key

Address(add_id,street,city,zip);

Now, how can I retrieve add_id from Address table and insert into Customer table ( in the add_fk field) using stored procedure with parameters?

I am using Oracle 9i.

 I would appreciate your help.

Thanks!

0
sthauttam
5/14/2007 7:55:57 PM
asp.net.oracle 2269 articles. 0 followers. Follow

4 Replies
954 Views

Similar Articles

[PageSpeed] 19

Are you using any of this data in between these actions? (eg: Are they going to reside in your page in a grid, or formview?)

 I ask because if you have a datasource already established for those, then it may be a bit simpler....


Daniel Pennington
(Insert Significant Credentials and Witty Comment Here)
0
dcpennington2
5/14/2007 11:07:42 PM

Hi! depennington2,

 I am going to input the data from the aspx page to the Oracle database. Also after retrieving the data from the database it is going to reside in a formview.

I would appreciate your help.

 Thanks!

0
sthauttam
5/14/2007 11:34:46 PM

Hello :)

 Well, since you'll have the stop-over in the formView, you can reuse it's datasource programmatically to do your Insert as well.

What I have done in the past for this is to create a structure of textboxes and use FormView.Rows.FindControl("myTextbox")

 

I'll try a small illustration here:

 Private Structure myDataIn '// I use a structure assuming a lot more elements, you may not need to bother with that

    Dim txt1 as textbox = CType(Me.fvMaster.Row.FindControl("ThePageNameOfMyTextBox1"), TextBox)

    Dim txt2 as textbox = CType(Me.fvMaster.Row.FindControl("ThePageNameOfMyTextBox2"), TextBox)

End Structure

myFormViewsDataSource.InsertCommand = "INSERT INTO tbl (myField1, myField2) VALUES('" + myDataIn.txt1.Text + "', '" + myDataIn.txt2.Text + "')"

myFormViewsDataSource.Insert

It's a quick-and-easy way to do it, and be able to have the kind of field-level control you may need....

There are many ways to do this though, I just thought this might be something that makes sense to you... You can Google the FindControl and such and get good links to MSDN...

Best of luck =)

 


Daniel Pennington
(Insert Significant Credentials and Witty Comment Here)
0
dcpennington2
5/15/2007 12:16:40 AM

thanks dcpennington2

 But I am sorry to say that I didn't understand. Actually, after  inserting  the data in  the Address table , the add_id (primary key)  of Address table should be copied or inserted to add_fk (foreign key) field of Customer table when I insert the Customer data. I am using asp.net 2.0 and C#

 Looking for your great help.

 thanks!

0
sthauttam
5/15/2007 2:26:04 AM
Reply:

Similar Artilces:

is there an sql statement to insert data to one table and getting the data from another table
Ok I have a table that have general categories with just name and CatNo. Now what I want to know is when I create a client to move all the data in general categories to another table called categories that have the clientid to associate it with the client. I would appreciate for any help what is your question here??Shravan Addaypally MCP...

Inserting Data into one table with category chosen from another table
Hi, I am a novice programmer. I have this problem and can't seem to find an answer to my problem. I have two tables, an artist and a category table. the artist table have the following fields, name, artist_id and cat_id, and my category table have the following fields, cat_id and category_name. Both tables is connected to each other.  I would like to insert artist names, in form view, and choose the category from a drop downlist. I have no idea how to do this. Can anybody help me. Thank you, Ruan Rossouw  Check this link. It has got example of exactly what you...

Stored procedure for insert data from one table to another table
Hi,      I am having 2 tables. One is main table and another is history table. Whenever I update the main table, I need to insert the all the main table data to History table, before updating the main table. Overall it is like storing the history of the table updation. How do i write a stored procedure for this? Anybody has done this before? Pls help me.   I think it's better to implement this logic in your application rather than from SQL side. Your application can accpect a sequence of parameters, and firstly insert them into the history; if ...

Inserting distinct data from one table in another table, how?!?Really urgent and needing help!!!
 Hi, I have a table in which I will insert several redundant data. Don't ask why, is Integration services, it only reads data and inserts it in a SQL table. THis way, I have a SQL table with several lines repeating them selves. What I want to do is create a procedure that reads the distinct data and inserts it in another table, but my problem is that I am not able to select data line by line on the original table to save it in local variables and insert it on the another table, I just can select the last line. I've tried a while cycle but no succeed. Here is my code: create...

How to move data from one table to another table w/o affecting the table definition?
Hello All! I have a production server and a development server. On the production server, I have a table (thin a database) that already contains data. On the development server, I created a table (still within another database) and I want that table of the development server to contain the data from the table of the production server. But, both tables don't have the same table definition, meaning in the table of the development server, I have added a new column named ID that I want to use as a primary key column, but I don't have tha...

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...

Inserting data from 1 table into another table
I am working on a blogging section for my website and have everything running except for a talkback section. I can insert the feedback but it is not assigned to a blog. I have 2 accessdatasource controls, 1 for the blog and the other for the talkback tables. The blog is displayed in a detailview control and the talkbacks are displayed on a repeater control. I have a loginview control used to enter the talkback. Blog Table: BlogID (Primary key) BlogSubject (Title) BlogText (Blog) BlogTimeStamp (Date/time posted) Talkback Table: TalkBackID (Primary key) BlogID (The blog...

Moving Data from one table to another table
------=_NextPart_000_0000_01C4ECC5.9C8C7660 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Maybe this is a little OT but since I am a beginner @ perl, I thought that I would post it! So, I am trying to move data from one sql table to another table called logs_archive. It seems that I am running into some problems with memory as I am moving this much data from one table to another. This is just syslog data but we need to archive it in some way. Can anybody give any advice? Code is below. $sth = $dbh->prepare( ...

pass data from one table to another table
hi i am building a shopping cart... and the cart is done in the form of table..i just want to pass all the data from one table to another table for example..someone has confirm his orders on the cart table, i want to pass all the confirm orderes to the ordered table.. later will remove all the confirmed orders in the cart table.. how can i do that?? i am using a sqldatasoure and i am trying to pass in the way below but failedINSERT INTO [History] ([CartID], [HProductName], [HQuantity], [HUnitPrice], [HTotal], [HUsername], [OrderedTime]) VALUES (@CartID, @CProductName, @Quantity, @UnitPr...

Inserting from datas in one table from Multiple tables
Hi guys,I have a problem with my query. What i want to happen is to populate my table EV_NOTIFICATIONDETAILS (Docownerid, CurrentSentDate, LastSentDate, detailsID, GeneralRemarks) using the datas from the two different tables EV_NOTIFICATIONHEADER and EV_DOCDETAILS.I tried to create some a query but im having a error. The problem is once i insert the data from datas to the columns Docownerid, CurrentSentDate, LastSentDate the datas are stored in the database and when i tried to insert the remaining columns TO EV_NOTIFICATIONDETAILS detailsID, GeneralRemarks getting the datas from EV_DOCDETAI...

Inserting Data Into Two Tables (Getting ID from Table 1 and inserting into Table 2)
I am trying to insert data into two different tables. I will insert into Table 2 based on an id I get from the Select Statement from Table1.  Insert Table1(Title,Description,Link,Whatever)Values(@title,@description,@link,@Whatever)Select WhateverID from Table1 Where Description = @DescriptionInsert into Table2(CategoryID,WhateverID)Values(@CategoryID,@WhateverID)  This statement is not working. What should I do? Should I use a stored procedure?? I am writing in C#. Can someone please help!!  Insert Table1(Title,Description,Link,Whatever)Values(@title,@descri...

try to copy data from one table into another table
PB8.0 , i built two tables, one is customer table,one is hosts table, they have some same columns,like customer name, company name ,etc. now, i built a datawindow of the customers, after i retrieve datas from the customer table to the datawindow , i hope i can copy datas of same columns from customer table to host table, so that i dont have to input same data again for the host table. what ways i can use and how to do? Use a Pipeline, at dawn datawindow. BMartins <jennifer> escreveu na mensagem news:447424fa.5223.1681692777@sybase.com... > PB8.0 , i built two ta...

Detailsview to read data from one table and insert to other table
Hi all, Hop you can help me out on this one - I am really stuck here !This Detailsview initially connects to the table ’trlesson’ and displays the data. What I am trying to achive is, to insert the edited data into another table ‘typerating’ – and not update ‘trlessondata’. In the code you can see both dataconnections; LessonData is where the data initially comes from, and then they are to be inserted in the table ‘typerating’ using the connection ‘typerating' Any suggestions ?Best regards        <body> <form id="form1" runat="serve...

Insert multiple records from one table to another table
Hello. Got a quick problem. I need to post shopping cart items from a temperary table "ShopCart" to a permanent table "tbl_orders". Problem is, I cannot figure out how to iterate through the recordset to post the unique products from "ShopCart" to "tbl_orders". The code below inserts the first product-- but that's it. If there are 6 different products, it will insert the first product 6 times. Public Sub GetShopCart() Dim ordernumber = session("ordernumber") Dim objConn as new SqlConnection(strConn) Dim strSQL as Str...

Web resources about - inserting data from one table to another table.. - asp.net.oracle

Inserting Kate
jurvetson posted a photo: the speaking GPS avatar that we came to love.. more prep photos below... You can hear her voice in the video compilation ...

Inserting the Galaxy Note 5’s S Pen backwards can permanently damage the device
One of the features Samsung highlighted when it unveiled the Galaxy Note 5 was the device's new S Pen slot design. The Note 5 features a spring-loaded ...


Inserting Slavery Into The Climate Debate
Chris Hayes compares the fight against fossil fuels to the abolitionist movement. He states plainly that “there is absolutely no conceivable ...

Samsung smart TVs inserting ads into third-party apps
... playback have pissed off a number of consumers. People with smart TVs from Samsung have been complaining that the electronics maker is inserting ...

Inserting images into Gmail could be so much better
When Google first launched the new compact compose window in Gmail, many of you might have noticed something annoying about inserting images. ...

Gawker tells Steven Crowder to "stop whining, take your licks, and accept that getting hit in the face ...
"... in the middle of an argument between billionaire-funded know-nothing ideologues and people whose livelihoods and stability are being threatened ...

Gmail's Shortcut for Inserting Hyperlinks
... but that doesn't mean Google shouldn't improve them. Many people complained that Gmail's rich text editor doesn't have a shortcut for inserting ...

Why Hollywood Is Inserting These Two Huge Chinese Actresses Into Its Summer Blockbusters
... It shows the enormous potential in China for distributors. We've previously discussed how Hollywood is starting to cater to China by inserting ...

Samsung SmartTVs are inserting ads into movies - Business Insider
Random Pepsi pop-up ads have been appearing when SmartTV users watch content through the device's third-party apps.

Resources last updated: 1/6/2016 2:58:41 AM