Information générale
Catégorie:
Visual FoxExpress
Hello Ken,
I am using Visual Basic to add records to the table ocdata.dbf
I am using the recordset.addnew and recordset.updates
's' is the variable i am using to add all the text content of a page and save to the table using recorset object.
*************Code************************
'Getting new ID
Dim maxno As Long
Dim newno As Long
Set rstemp = New ADODB.Recordset
rstemp.CursorLocation = adUseClient
rstemp.LockType = adLockOptimistic
rstemp.Open "Select ID from ocrdata order by ID", oconn, adOpenDynamic, , adCmdText
If rstemp.BOF = True Then
newno = 1
Else
rstemp.MoveLast
maxno = rstemp!id
If maxno = 0 Then
newno = 1
Else
newno = maxno + 1
End If
End If
rstemp.Close
rsocr.AddNew
rsocr!id = newno
If Item2 <> "" Then
rsocr!tiffile = Trim(FItem2)
End If
If s <> "" Then
rsocr!ocdata = Trim(s)
End If
rsocr!created_dt = Date
rsocr.Update
rsocr.Close
Set rsocr = Nothing
FItem2 = Null
Poss2 = Null
s = Null
**************************************************
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement