LEE DATOS DE UN Set RST.Query = QRY
Publicado por fenix (97 intervenciones) el 13/03/2009 22:02:01
Saludos a Tod@s.
Tengo un QRY que trabaja muy bien, pero nose como leer los datos que tiene. En el QRY busco un articulo por su CLASE, SUBCLASE y ESPECIFICO y cuando lo encuentre presentar su modelo, # serial, etc..
Dim fFind As New Find
'CurrentWindow.FindAll '------- Todos los Registros
VC = CurrentView.Body.Clase.Text
VS = CurrentView.Body.SubCla.Text
VE = CurrentView.Body.corre.Text
'------------------
CD = Chr(34) '--------- Comillas dobles para formar sentencias SQL
Path = CurrentDocument.Path '------ Via al documento
File = "eqINFOR.DBF" '------ Nombre de archivo
'----------------------- Inicializar variables
Set CON = New Connection
Set QRY = New Query
Set RST = New ResultSet
CON.ConnectTo("dBASE IV")
Set QRY.Connection = CON
QRY.TableName = Path + File
Set RST.Query = QRY
'------------ Ahora formamos la sentencia SQL. Sólo funciona la sentencia SELECT
'------------ no proebes con ninguna otra sentencia SQL, sólo va la SELECT.
' QRY.SQL = "SELECT * FROM " & CD & Path & File & CD & " WHERE Clase =' " & VC & " ' and SubCla = ' " & VS & " ' and Correlsc = ' " & VE & " ' "
Set RST.Query = QRY '---------- Ponemos el QUERY en el RESULTSET
RST.Execute '---------- Ejecutamos el QUERY
NumRecords = RST.NumRows '---------- Aquí nos devolverá el nº de registros
'-----------------------------
' Aqui comiensan mis problemas, pense que era asi pero no me funciona.
' CurrentView.Body.serie.Text = RST.serie
' CurrentView.Body.ccolor.Text = RST.grancc
' CurrentView.Body.nomodelo.Text = RST.nom_mod
Gracias de Antemano.
Tengo un QRY que trabaja muy bien, pero nose como leer los datos que tiene. En el QRY busco un articulo por su CLASE, SUBCLASE y ESPECIFICO y cuando lo encuentre presentar su modelo, # serial, etc..
Dim fFind As New Find
'CurrentWindow.FindAll '------- Todos los Registros
VC = CurrentView.Body.Clase.Text
VS = CurrentView.Body.SubCla.Text
VE = CurrentView.Body.corre.Text
'------------------
CD = Chr(34) '--------- Comillas dobles para formar sentencias SQL
Path = CurrentDocument.Path '------ Via al documento
File = "eqINFOR.DBF" '------ Nombre de archivo
'----------------------- Inicializar variables
Set CON = New Connection
Set QRY = New Query
Set RST = New ResultSet
CON.ConnectTo("dBASE IV")
Set QRY.Connection = CON
QRY.TableName = Path + File
Set RST.Query = QRY
'------------ Ahora formamos la sentencia SQL. Sólo funciona la sentencia SELECT
'------------ no proebes con ninguna otra sentencia SQL, sólo va la SELECT.
' QRY.SQL = "SELECT * FROM " & CD & Path & File & CD & " WHERE Clase =' " & VC & " ' and SubCla = ' " & VS & " ' and Correlsc = ' " & VE & " ' "
Set RST.Query = QRY '---------- Ponemos el QUERY en el RESULTSET
RST.Execute '---------- Ejecutamos el QUERY
NumRecords = RST.NumRows '---------- Aquí nos devolverá el nº de registros
'-----------------------------
' Aqui comiensan mis problemas, pense que era asi pero no me funciona.
' CurrentView.Body.serie.Text = RST.serie
' CurrentView.Body.ccolor.Text = RST.grancc
' CurrentView.Body.nomodelo.Text = RST.nom_mod
Gracias de Antemano.
Valora esta pregunta


0