Something like:
m.lcConnectionString = "server=sageserver;Integrated
Security=SSPI;Persist Security Info=False;Initial Catalog=APAC"
m.lnHandle = SQLSTRINGCONNECT(m.lcConnectionString,.T.) &&& 2nd
parameter as .T., as the single-connection-per user, shared by remote views
*!* SQLSETPROP(0,"DispLogin",lnDispLogin)
IF m.lnHandle < 0
lcMessage2 = "A connection handle could not be established to
the server specified in the GFLClaims.INI file."
WriteLog(m.lcLogFile, m.lcMEssage2 + ": " +
m.lcConnectionString)
*!* MESSAGEBOX(m.lcMEssage2 + CHR(13) + CHR(10) +
m.lcConnectionString, 16, "GFL Claims")
llSuccess = .F.
ENDIF
llSuccess = SQLEXEC(m.lnHandle,"SELECT <field list> FROM M2M_Booker
WHERE <where clause>", "c_MyLocalCursor")>0
IF NOT m.llSuccess
SQLDISCONNECT(m.lnHandle)
lcMessage2 = "Unable to connect to the server using the
specified connection"
WriteLog(m.lcLogFile, m.lcMEssage2)
llSuccess = .F.
ENDIF
Frank.
Frank Cazabon
On 30/11/2012 10:26 AM, Adam Buckland wrote:
Ok totally new to this so hopefully someone has done this before...
I have a view on SQL Server 2008 (It's a Sage accounts database if that
matters) which I need to get at from foxpro 6 and later V9
The view spans 8 tables and basically gets invoicing details that I need to
make a consolidated invoice to end up in a SAP system but to start with... is
there a way to get data from this view completely under Foxpro to a local
foxpro database without having to download individual tables and reconstruct
the view?
The database is called APAC on a server called sageserver and the view is
dbo.M2M_BOOKER and is as follows:
SELECT TOP (100) PERCENT dbo.SLCustomerAccount.CustomerAccountNumber,
dbo.SLCustomerAccount.CustomerAccountName, dbo.SOPInvCredAddress.PostalName,
dbo.SOPInvCredAddress.AddressLine1,
dbo.SOPInvCredAddress.AddressLine2, dbo.SOPInvCredAddress.AddressLine3,
dbo.SOPInvCredAddress.AddressLine4,
dbo.SOPInvCredAddress.City,
dbo.SOPInvCredAddress.County, dbo.SOPInvCredAddress.Country,
dbo.SOPInvCredAddress.PostCode,
dbo.SOPInvoiceCredit.DocumentNo AS [Invoice Number],
dbo.SOPInvoiceCredit.SecondReference AS Refrence2,
dbo.SOPInvoiceCredit.DocumentDate,
dbo.SOPInvoiceCreditLine.PrintSequenceNumber,
dbo.SOPInvoiceCreditLine.InvoiceCreditQuantity, dbo.SOPOrderReturnLine.ItemCode,
dbo.SOPInvoiceCreditLine.ItemName,
dbo.SOPOrderReturnLine.ItemDescription, dbo.StockItem.Code, dbo.StockItem.Name,
dbo.StockItem.Description,
dbo.SOPDocDelAddress.Description AS DELADDRESSDESC,
dbo.SOPDocDelAddress.PostalName AS DELADDRESSPOSTALNAME,
dbo.SOPDocDelAddress.AddressLine1 AS DELADDRESS1,
dbo.SOPDocDelAddress.AddressLine2 AS DELADDRESS2,
dbo.SOPDocDelAddress.AddressLine3 AS DELADDRESS3,
dbo.SOPDocDelAddress.AddressLine4 AS DELADDRESS4,
dbo.SOPDocDelAddress.County AS DELADDRESSCOUNTY,
dbo.SOPDocDelAddress.Country AS DELADDRESSCOUNTRY,
dbo.SOPDocDelAddress.PostCode AS DELADDRESSPOSTCODE,
dbo.SOPOrderReturnLine.LineQuantity, dbo.SOPOrderReturnLine.LineTotalValue,
dbo.SOPOrderReturnLine.LineTaxValue,
dbo.SOPOrderReturnLine.UnitSellingPrice,
dbo.SOPOrderReturnLine.SellingUnitMultiple,
dbo.SOPOrderReturnLine.PricingUnitMultiple
FROM dbo.SOPOrderReturn INNER JOIN
dbo.SOPInvoiceCreditLine ON
dbo.SOPOrderReturn.SOPOrderReturnID = dbo.SOPInvoiceCreditLine.SOPOrderReturnID
INNER JOIN
dbo.SOPInvoiceCredit ON
dbo.SOPInvoiceCreditLine.SOPInvoiceCreditID =
dbo.SOPInvoiceCredit.SOPInvoiceCreditID INNER JOIN
dbo.SLCustomerAccount ON
dbo.SOPInvoiceCredit.CustomerID = dbo.SLCustomerAccount.SLCustomerAccountID
INNER JOIN
dbo.SOPOrderReturnLine ON
dbo.SOPOrderReturn.SOPOrderReturnID = dbo.SOPOrderReturnLine.SOPOrderReturnID
AND
dbo.SOPInvoiceCreditLine.SOPOrderReturnLineID =
dbo.SOPOrderReturnLine.SOPOrderReturnLineID INNER JOIN
dbo.StockItem ON dbo.SOPOrderReturnLine.ItemCode =
dbo.StockItem.Code INNER JOIN
dbo.SOPInvCredAddress ON
dbo.SOPInvoiceCredit.SOPInvoiceCreditID =
dbo.SOPInvCredAddress.SOPInvoiceCreditID INNER JOIN
dbo.SOPDocDelAddress ON
dbo.SOPOrderReturn.SOPOrderReturnID = dbo.SOPDocDelAddress.SOPOrderReturnID
WHERE (dbo.SLCustomerAccount.SLCustomerAccountID = 18598)
ORDER BY [Invoice Number], dbo.SOPInvoiceCreditLine.PrintSequenceNumber
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
[excessive quoting removed by server]
_______________________________________________
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.