Redes
Redes
cmd.Parameters.AddWithValue("@cod_producto", cod)
cmd.Parameters.AddWithValue("@nombre", nom)
cmd.Parameters.AddWithValue("@precio", pre)
cmd.Parameters.AddWithValue("@stock", stock)
cmd.Parameters.AddWithValue("@cod_categoria", cate)
cmd.Parameters.AddWithValue("@Id_Proveedor", prov)
cmd.Parameters.AddWithValue("@Nom_Proveedor", nompro)
If (cmd.ExecuteNonQuery) Then
Return True
Else
Return False
End If
End Function
cmd.Parameters.AddWithValue("@cod_producto", cod)
cmd.Parameters.AddWithValue("@nombre", pro)
cmd.Parameters.AddWithValue("@precio", pre)
cmd.Parameters.AddWithValue("@stock", stock)
cmd.Parameters.AddWithValue("@cod_categoria", cat)
cmd.Parameters.AddWithValue("@Id_Proveedor", prov)
cmd.Parameters.AddWithValue("@Nom_Proveedor", nompro)
If (cmd.ExecuteNonQuery) Then
Return True
Else
Return False
End If
End Function
cmd.Parameters.AddWithValue("@cod_producto", cod)
If (cmd.ExecuteNonQuery) Then
Return True
Else
Return False
End If
End Function
Public Function mostrar_producto() As DataTable
conectado()
cmd = New SqlCommand("mostrar_producto", ccn)
cmd.CommandType = CommandType.StoredProcedure
Else
MessageBox.Show("Error al modificar el producto")
End If
Else
If (fc.insertar_producto(txtcodproducto.Text, txtnombre.Text,
txtprecio.Text, dmstock.Text, CboCategoria.Text, cboprove.Text, txtprove.Text) =
True) Then
MessageBox.Show("Producto registrado correctamente",
"REGISTRADO", MessageBoxButtons.OK, MessageBoxIcon.Information)
Cancelar()
mostrar_producto()
Else
MessageBox.Show("Error al registrar el producto")
End If
End If
Else
MessageBox.Show("Complete todos los campos")
End If
End Sub
Private Sub btneliminar_Click(sender As Object, e As EventArgs) Handles
btneliminar.Click
Dim c As New Productoo
If (c.eliminar_producto(txtcodproducto.Text) = True) Then
MessageBox.Show("Producto Eliminado Correctamente", "Eliminacion",
MessageBoxButtons.OK, MessageBoxIcon.Information)
Cancelar()
mostrar_producto()
Else
MessageBox.Show("Error al eliminar el cliente")
End If
End Sub
Sub mostrar_producto()
Dim fc As New Productoo
dtproducto = fc.mostrar_producto()
DGVCliente.DataSource = dtproducto
End Sub
Sub buscar_producto()
Dim fc As New Productoo
dtproducto = fc.buscar_producto(txtbuscar.Text)
DGVCliente.DataSource = dtproducto
End Sub
End Sub
Procedimientos
ALTER proc [dbo].[buscar](
@texto varchar(50) = '%')
as
select*from Prueba where (Id like '%' + @texto+ '%' or Nombre like '%' + @texto+
'%' )
)
as
DECLARE @num INT
Sub limpiar()
txtcodproducto.Clear()
txtnombre.Clear()
txtprecio.Clear()
dmstock.SelectedItem = -1
CboCategoria.SelectedIndex = -1
txtcodproducto.Enabled = False
txtnombre.Enabled = False
txtprecio.Enabled = False
dmstock.Enabled = False
CboCategoria.Enabled = False
End Sub