SteveoAtilla
Well-known member
I dont know why Im not getting this, but I have a page that needs to insert a row into an SQL Server 2000 table.
I have an SQL Connection: SqlConnection1
I have a Data Adapter: SQLDataAdapter1
I have a Data Set: Accessories2
I have a Stored procedure: "InsertAccessories"
I cant figure out how to fire the Stored Procedure. It gives no errors, but also inserts no rows.
What am I missing? Heres the code:
Whats missing?
Thanks,
Kahuna
I have an SQL Connection: SqlConnection1
I have a Data Adapter: SQLDataAdapter1
I have a Data Set: Accessories2
I have a Stored procedure: "InsertAccessories"
I cant figure out how to fire the Stored Procedure. It gives no errors, but also inserts no rows.
What am I missing? Heres the code:
Code:
MyCommand.CommandText = "InsertAccessories"
MyCommand.Connection = SqlConnection1
MyCommand.CommandType = CommandType.StoredProcedure
Dim P1 As New SqlParameter("@parent", SqlDbType.VarChar)
P1.Direction = ParameterDirection.Input
P1.Value = Session("EditPK")
MyCommand.Parameters.Add(P1)
Dim P2 As New SqlParameter("@child", SqlDbType.VarChar)
P2.Direction = ParameterDirection.Input
P2.Value = dgProducts.DataKeys.Item(dgProducts.SelectedItem.ItemIndex.ToString)
MyCommand.Parameters.Add(P2)
Execute the command
SqlDataAdapter1.SelectCommand = MyCommand
SqlDataAdapter1.InsertCommand.ExecuteNonQuery()
Whats missing?
Thanks,
Kahuna