Sub btnExportar_Click
Dim cuentaAnt As String
Dim sql As String
sql = "Select * FROM APVMOVIL Where APVEstado <> 'xx'"
Dim listaAPV As List
listaAPV = DBUtils.ExecuteMemoryTable(Starter.sql, sql, Null, 0)
If listaAPV.Size = 0 Then
Msgbox("No hay articulos para exportar", "Mensaje")
Else
Dim values() As String
cuentaAnt = 999999
For i = 0 To listaAPV.Size -1
values = listaAPV.Get(i)
cuentaIns = values(0)
If cuentaAnt <> cuentaIns Then
cuentaAnt = cuentaIns
ExecuteRemoteQuery("Select max(APVInstancia) from APV where CuentaID = " & cuentaIns , MAX_INSTANCIA)
maxinst = maxinst + 1
End If
ExecuteRemoteQuery("INSERT INTO APV VALUES ("&values(0)&", "&maxinst&", "&values(2)&", "&values(3)&", '"&values(4)&"', "&values(5)&", '"&values(6)&"', "&values(7)&", '"&values(8)&"', '"&values(9)&"', "&values(10)&", "&values(11)&", '"&values(12)&"',"&"' '"&",'', '"&values(13)&"')", LISTA_APV)
Next
End If
End Sub