Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/03/2004, 14:32
chovis
 
Fecha de Ingreso: julio-2003
Ubicación: mexico
Mensajes: 5
Antigüedad: 20 años, 9 meses
Puntos: 0
mi codigo es el siguiente y trabajo con VB6

Public Cadena As String
Public iSql As String
Public rst As ADODB.Recordset
Public Cnn As ADODB.Connection

Private Sub Form_Load()
Set Cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
Cadena = "DSN=backoff;uid=dba;pwd=sql;database=backoff"
Cnn.ConnectionString = Cadena
Cnn.Open
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text1.Text = "" Then
Text2.Text = "ESCANEE EL ARTICULO"
Else
iSql = "Select plunum, pludesc, retailprice From plu where plunum = " & Text1.Text & ""
rst.CursorLocation = adUseClient
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
rst.Open iSql, Cnn
If rst.EOF Or rst.BOF Then
Text1.Text = ""
Text2.Text = "EL ARTICULO NO EXISTE"
Text3.Text = ""
Else
Text1.Text = ""
Text2.Text = rst!pludesc
Text3.Text = Format(rst!REtailprice, "$ ######0.00")
End If
rst.Close
End If
End If
End Sub