Results 1 to 2 of 2

Thread: Insert data in two tables using stored procedure

  1. #1

    Insert data in two tables using stored procedure

    I have two input fields viz. name and street in the webpage. When the user input name and street, how can I insert that data in two tables Customer and Address using stored procedure with parameters? The table structure is like this

    Customer(customer_id,address_id,name) // address_id is the foreign key.

    When the user input street and name from webpage, Address table should be filled first and the address_id of Address table should be input to the Customer table along with name.

    Could you please help me how to implement this using triggers and stored procedure?



    Question asked by visitor Uttam

  2. #2
    Junior Member
    Join Date
    Jun 2007

    Question Re: Insert data in two tables using stored procedure

    Dear Friends,

    I face the same problem while i am doing project and i found solution that

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim oracon As New Data.OleDb.OleDbConnection

    oracon.ConnectionString = "Provider=MSDAORA.1;Password=patel;User ID=scott;data source=adarsh;Persist Security Info=True"

    Dim cmd As New Data.OleDb.OleDbCommand

    Dim param1 As New Data.OleDb.OleDbParameter
    Dim param2 As New Data.OleDb.OleDbParameter

    param1.ParameterName = "param1"
    param1.OleDbType = Data.OleDb.OleDbType.VarChar
    'param1.Size = 12
    param1.Direction = Data.ParameterDirection.Input
    param1.Value = "20-05-2007"

    param2.ParameterName = "param2"
    param2.OleDbType = Data.OleDb.OleDbType.VarChar
    'param2.Size = 5
    param2.Direction = Data.ParameterDirection.Input
    param2.Value = "AHD"

    cmd.CommandType = Data.CommandType.StoredProcedure
    cmd.Connection = oracon
    cmd.CommandText = "example1"


    'cmd.CommandText = "{execute Example1(?,?)}"
    'cmd.CommandText = "{execute Example2(param2)}"

    This solution is for my program, you can get hint

    Adarsh Patel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.