I am in the process of converting to PostgreSQL. I would like to do everything 
I need using my existing DBC/DBF files first to be 
sure I have all the data access separated from the user interface and also get 
some experience. This is a very old application 
dating back to 1977 using Basic Plus on DEC computers, converted to Fox dos 
then VFP with more than 1 million lines of code so it 
will take some time. Mainly I am just playing around trying to decide how I 
want to do it.

My code is using ole db and recordsets. I should have put more code: (think I 
figured out how to browse using some code on 
foxite.com) vfp has really incredible resources available. I hope python is 
that good when I finally get everything converted in 
about 4 - 6 years. I hope there are other people on this list going through a 
similar conversion. Foxite has more examples than you 
have time to review.

* my code below. This does work and is a good start for accessing anything in 
the dbc
loCN = Createobject("ADODB.Connection")
loRS = Createobject([ADODB.RecordSet])

loCN.ConnectionString = "provider=vfpoledb.1;data 
source=U:\ssi\304901\Share\ptshare.dbc"
loCN.Open

If loCN.State = 1    && If Connection is fine, create RecordSet
   loRS.ActiveConnection = loCN
   loRS.CursorType = 1 && adOpenKeySet
   loRS.LockType   = 3 && adLockOptimistic
   loRS.Open("Select * From m6nmpt")

   ?loRS.RecordCount   && Display Number of Records
   loRS.MoveFirst    && Start At the Top of the File

   Do While Not loRS.Eof
      ? "******************** new record"
      For lnI = 1 To loRS.Fields.Count
         If lnI = 1
            ? loRS.Fields(lnI-1).Value
         Else
            ? loRS.Fields(lnI-1).Value
         Endif
      Endfor
      loRS.MoveNext()
   Enddo
Endif

----- Original Message ----- 
From: "Stephen Russell" <[EMAIL PROTECTED]>
To: "ProFox Email List" <profox@leafe.com>
Sent: Friday, April 04, 2008 12:55 PM
Subject: Re: SQL Passthrough and ODBC


On Fri, Apr 4, 2008 at 2:48 PM, kam <[EMAIL PROTECTED]> wrote:

> Can you show me the code to browse a specific table (or select * from
> MyTable)
>
> OConn is an object with properties so the code below seems to work. In
> this dbc there is a table named m6nmpt.dbf and a view to
> look at all the data named vnmpt  (the view has the same data you would
> get from select * from m6nmpt). Even better, is there a
> reference for working with oledb in vfp9 sp2?  the Microsoft site has a
> lot of information, but it is very superficial and never
> (at least I can't find it) shows the code for accessing/updating data.
>
>
>  OConn = CREATEOBJECT("ADODB.Connection")
>   OConn.ConnectionString = "provider=vfpoledb.1;data
> source=U:\ssi\304901\Share\ptshare.dbc"
>   OConn.Open
>
>
----------------------------------------------------------------------------

Are you in VFP and using ODBC for a dbf?  Why?

Why not open database U:\ssi\304901\Share\ptshare.dbc
Then do the Select from there?

No if your in VB, Delphi etc then you need that oldeb functionality.





-- 
Stephen Russell
Sr. Production Systems Programmer
Mimeo.com
Memphis TN

901.246-0159


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://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.

Reply via email to