PDA

Click to See Complete Forum and Search --> : INSERT stored procedure...


percival
Apr 21st, 2004, 03:32 AM
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....

wey97
Apr 21st, 2004, 08:44 AM
What's the error?

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

wey97
Apr 23rd, 2004, 11:08 AM
Post the table schema, stored procedure text and your db connection string.

You're not giving enough detail for your problem.