Results 1 to 1 of 1

Thread: Using the VFP OleDB driver with Lianja

  1. #1
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,183
    Blog Entries
    22

    Using the VFP OleDB driver with Lianja

    In v1.3RC7 I now have the VFP OLEDB driver working as it should. As OLEDB is just another ActiveX you can use this in Desktop and Web/Mobile Apps (Cloud Server handles ActiveX in v1.3).

    Example:

    Code:
    private oConn, oRS, m_count
    oConn = createobject("ADODB.Connection")
    oRS = createobject("ADODB.Recordset")
    lcConnString = "Provider=vfpoledb;Data Source=C:\Temp\Northwind\northwind.dbc"
    oconn.ConnectionString = lcConnString
    oconn.Open()
    oRS.Open("select * from customers where customerid='BOTTM'", oconn)
    m_count = oRs.fields.count
    // display the first record selected
    for i=0 to m_count
        try
            ? "Name=" + oRS.Fields.item(i).Name + ",value=" + etos(oRS.Fields.item(i).Value)
        catch
            // ignore error from Memo
        endtry
    endfor
    Notice how you must use the item() method on the Fields property as this is exposed only as a property not a method.

    The output produced is as follows:

    Code:
    Name=customerid,value=BOTTM
    Name=companyname,value=Bottom-Dollar Markets                   
    Name=contactname,value=Elizabeth Lincoln             
    Name=contacttitle,value=Accounting Manager            
    Name=address,value=23 Tsawassen Blvd.                                          
    Name=city,value=Tsawassen      
    Name=region,value=BC             
    Name=postalcode,value=T2F 8M4   
    Name=country,value=Canada         
    Name=phone,value=(604) 555-4729          
    Name=fax,value=(604) 555-3745
    Note: There is a known issue with retrieving memo fields using the VFP OleDB driver which is why I used TRY/CATCH to ignore the error.
    Last edited by barrymavin; 2014-12-27 at 00:51.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us