lnSQLhandle = 0
=SQLSETPROP(0, 'Displogin', 3)
lnseconds = 15
=SQLSETPROP(0, 'ConnectTimeOut', lnseconds)
lnSQLhandle = SQLSTRINGCONNECT(lcURL)
IF lnSQLhandle > 0
lcReturn = 'Congratulations! You are connected to the link'
MESSAGEBOX(lcReturn)
ELSE
lcReturn = 'failure: Return Code: ' + transform(lnSQLHandle) + '
Connection could not be established: ' + lcURL + CHR(13) + CHR(10) + ;
'Contact ....'
MESSAGEBOX(lcReturn)
RETURN -1
ENDIF
* Connect fine
************************************Test***********************************
hours = 24
m._wkdatetime = datetime()
select 0
use dcwrktmp_upload.dbf
* first I load insert each record in the sql server table
* no filtering or index just scan & insert
SCAN
lcstring = 'INSERT INTO SQLSERVERTABLE (' + ;
'DP_WKSEQNO, ' + ;
'DP_WKCOMPANY_PS, ' + ;
'DP_WKPAYGROUP_PS, ' + ;
'DP_WKPAYGROUP, ' + ;
'DP_WKDATE, ' + ;
'DP_WKTRIPNO, ' + ;
'DP_WKTRIPQ, ' + ;
'DP_WKEVENT, ' + ;
'DP_WKSTDATE, ' + ;
'DP_WKSTTIME, ' + ;
'DP_WKENDDATE, ' + ;
'DP_WKENDTIME, ' + ;
'DP_WKMINS, ' + ;
'DP_WKSTAT, ' + ;
'DP_WKDRIVER, ' + ;
'DP_WKCODE1, ' + ;
'DP_WKCODE2, ' + ;
'DP_WKLOC, ' + ;
'DP_WKACCNT, ' + ;
'DP_WKHUB, ' + ;
'DP_WKTODMILES, ' + ;
'DP_WKMIMARK, ' + ;
'DP_WKWEIGHT, ' + ;
'DP_WKQUANT, ' + ;
'DP_WKHOOK1, ' + ;
'DP_WKPAYCODE, ' + ;
'DP_WKGUID, ' + ;
'DP_WKDATETIME, ' + ;
'DP_WKSTATUS, ' + ;
'DP_WKPROCESSED) VALUES (' + ;
TRANSFORM(wkseqno) + ', ' + ;
"'" + pscompany + "', " + ;
"'" + pspaygroup + "', " + ;
"'" + wkpaygroup + "', " + ;
"'" + wkdate + "', " + ;
"'" + wktripno + "', " + ;
"'" + wktripq + "', " + ;
"'" + wkevent + "', " + ;
"'" + wkstdate + "', " + ;
"'" + wksttime + "', " + ;
"'" + wkenddate + "', " + ;
"'" + wkendtime + "', " + ;
"'" + wkmins + "', " + ;
"'" + wkstat + "', " + ;
"'" + wkdriver + "', " + ;
"'" + wkcode1 + "', " + ;
"'" + wkcode2 + "', " + ;
"'" + wkloc + "', " + ;
"'" + wkaccnt + "', " + ;
"'" + wkhub + "', " + ;
"'" + wktodmiles + "', " + ;
"'" + wkmimark + "', " + ;
"'" + wkweight + "', " + ;
"'" + wkquant + "', " + ;
"'" + wkhook1 + "', " + ;
"'" + wkpaycode + "', " + ;
"'" + wkguid + "', " + ;
'?m._wkdatetime' + ', ' + ;
"'" + wkstatus + "', " + ;
"'N')"
lnsuccess = SQLEXEC(lnSQLhandle, lcstring)
IF lnsuccess < 1
=MESSAGEBOX('SQL Select failed: ' + TRANSFORM(lnsuccess) + "'" +
lcstring + "'")
lclogstring = lclogstring + lcstring + lccrlf + lccrlf
EXIT
ENDIF
ENDSCAN
* now I read the file to verify the load
lcstring = "SELECT * FROM SQLSERVERTAB LE"
lnsuccess = SQLEXEC(lnSQLhandle, lcstring)
IF lnsuccess < 1
=MESSAGEBOX('SQL Select failed: ' + lcstring)
lclogstring = lclogstring + lcstring + lccrlf + lccrlf
* RETURN (lnsuccess)
ELSE
WAIT WINDOW 'SQL Select successful: ' + lcstring NOWAIT
SELECT SQLRESULT
COPY TO 'dcwrktmp_download_test.dbf'
USE IN SQLRESULT
IF USED('dcwrktmp_download_test')
SELECT dcwrktmp_download_test
ELSE
SELECT 0
USE dcwrktmp_download_test.dbf
ENDIF
* here is where I discover the missing records
BROWSE
USE IN dcwrktmp_download_test
ENDIF
Jeff
Jeff Johnson
SanDC, Inc.
(623)-582-0323
www.san-dc.com <http://www.san-dc.com>
www.cremationtracker.com <http://www.cremationtracker.com>
www.arelationshipmanager.com <http://www.arelationshipmanager.com>
On 1/2/2014 5:26 PM, Frank Cazabon wrote:
On 02/01/2014 06:50 PM, Jeff Johnson wrote:
I am scanning a dbf and inserting records into a sql server table.
For some reason for the first half of the table it is skipping 440
records. After half way through it is up to date.
Immediately after I load the table I do a select on it and that tells
me I skipped all of those records.
I don't know if it skipped the records or my subsequent query is not
selecting all of the records.
Any ideas?
Can you show us some code?
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
multipart/related
text/html
image/jpeg
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.