Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/04/2011, 18:39
chelocho
 
Fecha de Ingreso: abril-2011
Mensajes: 9
Antigüedad: 13 años, 1 mes
Puntos: 0
Respuesta: tomar valores desde Bd sql

jefe, te paso el procedimieto desde donde lo llamo,
le paso mi dato desde un textbx

Public Sub actualizar(ByVal a As Integer)
Try
'crear commanbiulder
Dim conexion As New SqlClient.SqlConnection
conexion.ConnectionString = cnn
Dim sel As String
sel = "SELECT * FROM DETALLE_COMPRA_PROV WHERE COD_COMPRA_PROV =( SELECT COD_COMPRA_PROV FROM COMPRA_PROVEEDOR WHERE NUMERO_FACTURA = @a)"

cmm = New SqlClient.SqlCommand(sel, conexion)
Me.cmm.Parameters.Add("@a", a)

'crear(adapter)
DGAdapter = New SqlClient.SqlDataAdapter(cmm)
'crear dataset
Dsdep_detalle = New Data.DataSet
DGAdapter.Fill(Me.DsDetalle_Compra_Proveedor1, "DETALLE_COMPRA_PROV")
'asignar dataset al datagrid
Me.dgRecepcion_Mercaderia.DataSource = Me.DsDetalle_Compra_Proveedor1
Me.dgRecepcion_Mercaderia.DataMember = "DETALLE_COMPRA_PROV"

DGAdapter.Update(Me.DsDetalle_Compra_Proveedor1, "DETALLE_COMPRA_PROV")
Catch ex As Exception
MsgBox(ex.Message())
End Try

End Sub

..me hubiera saltado el error si no le ejecutaba la sentencia!! porque hago que salte error si tiene con el catch error.. la werdad que no se que pasa!!alguna otra opcion jefe!!
graxias por el tiempo!!