OK LES MUESTRO QUE HE LOGRADO AVANZAR ASTA EL MOMENTO .
COMO LES ABIA DICHO ANTERIROMENTE LO QUE DESEO ACER ES LO SIGUIENTE TODO LO QE ESTA EN EL DATAGRIDVIEW1 Y QUE NO ESTA ENLAZADO A NINGUNA BASE DE DATOS Y QUE CON UN BOTON VOY AGREGANDO LOS DATOS EN EL DATAGRIDVIEW1, CON ESOS DATOS QIERO ACTUALIZAR UNA TABLA DE MI BASE DE DATOS PERO SOLO AQUELLOS Q TENGAN EL MISMO CODIGO DE PRODUCTO.
POR ELMOMENTO ESTOY REALIZANDO LO SIGUIENTE AGREGO UNICAMENTEO 2 PRODUCTO AL DATAGRIDVIEW1 Y AL HACER CLIC EN EL BOTON
COMPARAR ME COMPARA EL 1ER CODIGO DE PRODUCTO QUE ESTA EN EL DATAGRIDVIEW1 CON EL QUE ESTA EN LA BASE DE DATOS Y EL
PROBLEMA ES EL SIGIENTE QUE UNICAMENTE SOLO COMPARA EL 1ER PRODUCTO DEL DATAGRIDVIEW1 NO AVANZA AL SEGUNTO PARA ESTE SER COMPARADO CON LOS Q ESTAN EN LA BASE DE DATOS
LES ABIA DICHO Q TENGO 2 DATAGRIDVIEW AL MONETO DE HACER CLIC EN EL BOTON
COMPARAR MUESTRA EL CODIGO DEL PRODUCTO QUE ES IGUAL EN EL DATAGRIDVIEW1 CON EL DE LA BASE DE DATO Y ESTE CODIGO LO MUESTRA EN EL DATAGRIDVIEW2
AQUI LES DEJO EL CODIGO TALVEZ DESDE AQUI ME BRINDA UNA AYUDA
TODO ESTO ES CODIGO VBNET
Código PHP:
Public Sub actualizar_tabla_producto()
Dim codigos, sqlbuscar As String
Dim i As Integer = 0
codigos = DataGridView1.CurrentRow.Cells(1).Value
Try
' Establecemos la conexión con la base'
Using cnn As New SqlConnection("Data Source=BT-PC\SQLEXPRESS;Initial Catalog=ferr2013;Integrated Security=True")
sqlbuscar = ("SELECT cod_producto FROM producto WHERE cod_producto ='" & codigos & "'")
' Creamos el adaptador de datos'
Dim da As New SqlDataAdapter(sqlbuscar, cnn)
' Creamos un nuevo objeto DataTable'
Dim dt As New DataTable("producto")
' Rellenamos el objeto DataTable'
da.Fill(dt)
For Each Dt_Row As DataGridViewRow In DataGridView1.Rows
If Dt_Row.Cells("codprod").Value.ToString = dt.Rows(i)("cod_producto").ToString Then
DataGridView2.DataSource = dt
End If
Next
End Using
Catch ex As Exception
MessageBox.Show(ex.Message) 'Se ha producido un error'
End Try
End Sub