Results 1 to 3 of 3

Thread: INSERT stored procedure...

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Location
    47-B Silliman Ave. Dgte. City
    Posts
    4

    INSERT stored procedure...

    Hi guys!

    Can u please help me how to conect the INSERT stored procedure to ASP web application.

    I have a sample code here but it wont work. It wont add new rows to the database. Is there something wrong with this code?

    SqlConnection1.Open()
    SqlDataAdapter1.InsertCommand.Parameters(1).Value=TextBox1.Text
    SqlDataAdapter1.InsertCommand.Parameters(2).Value = TextBox2.Text
    SqlDataAdapter1.InsertCommand.Parameters(3).Value = TextBox3.Text
    SqlDataAdapter1.InsertCommand.Parameters(4).Value = TextBox4.Text
    SqlDataAdapter1.InsertCommand.Parameters(5).Value = TextBox5.Text
    SqlDataAdapter1.InsertCommand.ExecuteNonQuery()
    SqlConnection1.Close()


    assuming that I have 5 parameters in stored procedure....

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    What's the error?

    The array index may start at zero like Parameters(0)...not sure.

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    Post the table schema, stored procedure text and your db connection string.

    You're not giving enough detail for your problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width