OK Muchas Gracias, pasa lo siguiente el resultado de esta ejecución me devuelve 148 Filas.
'EJECUTAR CONSULTA PARA EXPLOSIÓN - USOS.
Código:
Ejecutar("WITH MExplosion (PARPRT_02, COMPRT_02, nivel, Referencia) AS (SELECT r.PARPRT_02, r.COMPRT_02,0 AS nivel, PARPRT_02 as Referencia FROM Product_Structure as r UNION ALL SELECT r.PARPRT_02, r.COMPRT_02, nivel + 1, Referencia FROM Product_Structure as r INNER JOIN MExplosion AS d ON r.PARPRT_02 = d.COMPRT_02 ) SELECT Referencia, COMPRT_02, nivel, PMDES1_01 FROM MExplosion INNER JOIN Part_Master ON MExplosion.COMPRT_02 = Part_Master.PRTNUM_01 INNER JOIN Part_Sales ON Part_Sales.PRTNUM_29 = Referencia WHERE COMPRT_02 LIKE '" & Me.partes.SelectedRows(0).Cells(0).Value.ToString & "%'")
While Lector.Read
Me.usos.Text = Lector(0).ToString + ","
End While
Y Necesito ir listando en mi objeto de texto los valores que me devuelve la primera columna, pero al plantear mi código así el programa se queda hay y no responde a que puede deberse esto????
La función quedo de esta forma
Código:
Public Function Ejecutar(ByVal cScriptSQL As String) As String
Dim Activo As Boolean
If cScriptSQL <> vbNullString Then
Conexion.Open()
Comando = New Odbc.OdbcCommand(cScriptSQL, Conexion)
Try
Lector = Comando.ExecuteReader()
MessageBox.Show("Consulta Script OK")
Conexion.Close()
Activo = True
Catch ex As Exception
MessageBox.Show("Error al ejecutar el script SQL:" & vbCrLf & ex.Message)
Activo = False
End Try
End If
Return Activo
Saludos.