
01/12/2007, 11:15
|
 | | | Fecha de Ingreso: mayo-2007
Mensajes: 98
Antigüedad: 17 años, 9 meses Puntos: 0 | |
consulta boton eliminar hola, tengo un boton afuera del gridview que al seleccionar una fila posteriormente la elimina.
codigo:
cmd = New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "spEliminaDetalleSolicitud"
cmd.Connection = cn
Dim da As New SqlDataAdapter
da.DeleteCommand = cmd
Dim dsol_id As New SqlParameter("@dsol_id", SqlDbType.Int)
Dim dsol_talla As New SqlParameter("@dsol_talla", SqlDbType.VarChar, 50)
Dim dsol_color As New SqlParameter("@dsol_color", SqlDbType.VarChar, 50)
Dim dsol_cantidad As New SqlParameter("@dsol_cantidad", SqlDbType.Int)
Dim dsol_estado As New SqlParameter("@dsol_estado", SqlDbType.VarChar,50)
da.DeleteCommand.Parameters.Add(dsol_id)
da.DeleteCommand.Parameters(0).Value = TextBox1.Text
da.DeleteCommand.Parameters.Add(dsol_talla)
da.DeleteCommand.Parameters(1).Value = txtTalla.Text
da.DeleteCommand.Parameters.Add(dsol_color)
da.DeleteCommand.Parameters(2).Value = txtColor.Text
da.DeleteCommand.Parameters.Add(dsol_cantidad)
da.DeleteCommand.Parameters(3).Value = txtCantidad.Text
da.DeleteCommand.Parameters.Add(dsol_estado)
da.DeleteCommand.Parameters(4).Value = txtEstado.Text
Try
Using cn
cn.Open()
da.DeleteCommand.ExecuteNonQuery()
da.Dispose()
cmd.Dispose()
End Using
Catch ex As Exception
End Try
ahora mi consulta es puedo mover ese codigo al boton eliminar del gridview?
ya que lo copie en GridView1_RowDeleted,GridView1_RowDeleting,SqlData Source1_Deleted,SqlDataSource1_Deleting y me borra la fila pero me dice este mensaje despues "La acción de eliminar no es compatible con el origen de datos 'SqlDataSource4' a menos que se especifique DeleteCommand. " |