Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP interface to MYOB
Message
From
12/09/2006 20:00:57
 
 
To
12/09/2006 19:34:39
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
01153174
Message ID:
01153176
Views:
22
>Hi,
>
>We have a Visual Foxpro 8 application that we sould like to use to update MYOB data using the MYOB ODBC driver. We have successfully created a DSN, connected to MYOB and retrieved data from MYOB.
>
>We have been unable to successfully write to any MYOB tables or to determine how to retrieve error and warning messages using Visual Foxpro.
>
>Are there any example progams for writing data using Visual Foxpro?
>
>The code we are using is as below:
>
>**** Set up MYOB connection string for read-write access
>thisform.r_cConnStr = ;
>"DSN=myob;" + ;
>"DRIVER_COMPLETION=DRIVER_NOPROMPT;" + ;
>"ACCESS_TYPE=READ_WRITE;" + ;
>"IDENTIFY_BY=CARD_ID;" + ;
>"INSERT_TYPE=REJECT_DUPLICATES;" + ;
>"SUPPRESS_WARNING=TRUE;"
>
>**** Make the connection
>thisform.r_nConnHandle = SQLSTRINGCONNECT(thisform.r_cConnStr ,.T.)
>IF thisform.r_nConnHandle <= 0
>= MESSAGEBOX('Error connecting to MYOB data source.', MB_ICONSTOP, 'MYOB Connection Error')
>RETURN .F.
>ENDIF
>lnRes = sqlsetprop(thisform.r_nConnHandle, 'DispLogin', 3) && Set ODBC login Never
>lnRes = sqlsetprop(thisform.r_nConnHandle, 'Asynchronous', .F.) && Results returned asynchronously
>lnRes = sqlsetprop(thisform.r_nConnHandle, 'BatchMode', .T.) && Result sets returned all at once
>
>WAIT WINDOW "Retrieving all MYOB cusomers..." nowait
>lnRes = SQLEXEC(thisform.r_nConnHandle, 'SELECT * FROM MYOB.customers', 'vCustomers')
>*
>*--- The above command succeeds and all Customers are returned
>*
>lcSql = "INSERT INTO Import_Consolidated_Taxcodes VALUES ('TST','','WET')"
>lnRes = SQLEXEC(thisform.r_nConnHandle, lcSQL)
>*
>*--- The above insert statement fails (lnRes = -1)
>*
>
>Any suggestions would be most gratefully received,
>
>TIA,
>
>Andrew Harper

Use AERROR() to see why your last SELECT failed in your SQLEXEC.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform