Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

odbc 1

Status
Not open for further replies.

WedHouse

Technical User
Apr 25, 2024
8
ID
how to open database on odbc..
I made a loan application based on FoxPro 8 and all the coding I included was based on forum suggestions not from the forum. After I decompile the program again because I wanted to insert the coding for restrictions in terms of financing, there were obstacles namely 'cannot find customer object from database'..
I will look again on database enviroment there are several dbc based on view and remote view the question is... How to determine the parent table / the first data source when creating a view..??[URL unfurl="true"]https://res.cloudinary.com/engineering-com/raw/upload/v1714030350/tips/trouble_view_on_vfp_8_lfiusy.docx[/url]
 
Which flavour of database?



Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
A big subject for a forum post. Where are you starting from? How much do you already know about remote access in VFP and about back-end databases in general?

And, most importantly, have you read the Help topics on the subject? If you search the Help for ODBC, you will find a dozen or more useful topics. "How to Set Up an ODBC Data Source" would be a good one to start with.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I would add, if you are thinking of accessing a vfp database via odbc, look at the vfp9 oledb instead.
The odbc is not thread safe...

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
One more thing that's special and differs from any other ODBC handling of databases, if the target is a VFP databas DBC): As the only two qualitatively different types of odbc connection strings are for a directory of (free) dbfs or or a DBC (database container aka database).

Making the connection you already have established the connection to either the directory or have already opened the dbc, so the next step you can do is already SQL queries or USE of a table, so you don't need the OPEN DATABASE command of VFP to open a dbc, you make a connection to a DBC and it is opened by making the connection. Make a connection to a directory of dbfs you obviously don't need to OPEN DATABASE, as it's meant for free tables, dbfs that are standalone and don'T belong to a dbc, which have some less features. In that case the ODBC driver will already have set its default directory to that directory.

Both the VFP ODBC driver (up to version 6) and OLEDB provider (up to version 9, so always the better choice) allow a subset of the VFP language, basically everything that could cause dialogs is not allowed and in some ways functions and commands creating files (except creating tables) are not allowed.

In many other databses this does not differ, because you usually don'T just connect to a database server, but to a database within that server instance, but in many cases you could just connect to the server and then would first need to execute something like SET DATABASE or USE DATABASE, but that situation does not apply to VFP, as the possible connections you make already are about either a directory with dbfs or a DBC.

Chriss
 
i use this coding..

SELECT ObjectName FROM pinjaman.dbc ;
WHERE ObjectType = 'View' OR ;
ObjectType = 'Table' ;
INTO CURSOR GetTBLnames

in this coding that i copy from this forums. it shows the contents of the database designer. including tables and views without remote view.
and this another coding..

SELECT UPPER(Debitur.ao), Debitur.ao FROM pinjaman!debitur WHERE Debitur.flag = 1 GROUP BY 1

DBSetProp(ThisView,"View","SendUpdates",.T.)
DBSetProp(ThisView,"View","BatchUpdateCount",1)
DBSetProp(ThisView,"View","CompareMemo",.T.)
DBSetProp(ThisView,"View","FetchAsNeeded",.F.)
DBSetProp(ThisView,"View","FetchMemo",.T.)
DBSetProp(ThisView,"View","FetchSize",100)
DBSetProp(ThisView,"View","MaxRecords",-1)
DBSetProp(ThisView,"View","Prepared",.F.)
DBSetProp(ThisView,"View","UpdateType",1)
DBSetProp(ThisView,"View","UseMemoSize",255)
DBSetProp(ThisView,"View","Tables","pinjaman!debitur")
DBSetProp(ThisView,"View","WhereType",3)

DBSetProp(ThisView+".exp_1","Field","DataType","C(10)")
DBSetProp(ThisView+".exp_1","Field","UpdateName","PÚ¤*")
DBSetProp(ThisView+".exp_1","Field","KeyField",.F.)
DBSetProp(ThisView+".exp_1","Field","Updatable",.F.)

DBSetProp(ThisView+".ao","Field","DataType","C(10)")
DBSetProp(ThisView+".ao","Field","UpdateName","pinjaman!debitur.ao")
DBSetProp(ThisView+".ao","Field","KeyField",.T.)
DBSetProp(ThisView+".ao","Field","Updatable",.T.)

The question in this problem is determining the 'debitur' database or 'customer' database. on pinjaman.dbc only 5 table and not cointain tabelname like 'debitur' or customer.
 
Hello,

if you open the DBC in VFP , select the view, select edit in the view designer you can see the table(s) and relations on which the view is based.
You can also see fields, tables,...
I myself also like the "SQL-View" in the view designer, right click in the part showing the tables.

Another way would be to open the DBC as a table and browse / search it.

Just a question
Why do you decompile a program you made by your own ?
You have the source and maybe add a "set step on" in the line before error appears.

Regards
tom
 
actually iam junior staff at my company. I developed this program again because the senior staff where I worked had retired.
and when I confirm about this loan program. he didn't answer, he just gave a project program. that the reason that i ask to this forums.
i have all the source code is. after i build again it shown massage like 'cannot find debitur form database'
 
So you are asking the wrong question. Your original question (which you later edited) was "how to open database on odbc". The fact that you have successfully executed two SELECT statements and a bunch of DBSETPROPs means that you have already got past that stage.

I realise that it is very difficult for you to maintain a system written by another developer who cannot or will not help. But it's even more difficult for us to debug your code based on the small amount of information available to us.

I can only suggest that you spend some time learning the fundamentals of remote access, and come back when you have some specific questions.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
So you have a DBC with remote views to a remote database. That's one way to work with a remote database, where "remote" can mean many things, but clearly not a VFP database.

Well, and you want to see the remote views, but don't see them with the query selecting db objects. You should.

But much more simpler, you can look into all the dbc has in it just by OPEN DATABASE your.dbc and then MODIFY DATABASE in the command window. That will visually show all database objects, tables and views, both local views and remote views, also connection objects that are essential for the remote views to work and be able to connect to the remote database.

If you don't find remote views in a dbc, you likely look into the wrong DBC.

WedHouse said:
he just gave a project program
What do you mean by that? There are projects in VFP, that are PJX files, but not programs. There are programs in VFP, PRG files, but they are not project files.

You're not having any idea about VFP, then you couldn't maintain a project no matter how precisely you are pointed to the essential starting points, a project (PJX) can be double clicked in the Windows File Explorer, to open up this project within VFP, just like a double click on a solutio file (sln ending) opens up that solution in Visual Studio, provided VFP and VS are installed, of course.

Having the project without any foxpro knowledge you'll not have it easy to maintain it, make changes and upgrades.

You can't replace a FoxPro developer with help from a forum about VFP, so your company should search for a VFP developer to hire, shouldn't it? That's much more of a polititcal problem than a technical, and I'm afraid we can't support you as much as you'd need support.

Chriss
 
tomk3 said:
Why do you decompile a program you made by your own ?
I second that question.

If you are actually trying to own a product you didn't develop, then the lesson to learn here is that you have to do much more than decompiling that product.

Chriss
 
hay chriss..
maybe it seem like that. i develop another person or decompile another persons project. well.. thanks for sugestion. may be i try learning from mike learning fundamental of remote access..[bigsmile]
 
WedHouse said:
may be i try learning from mike learning fundamental of remote access..[bigsmile]

Well, that was only referring to the detail question you had. Now it is more obvious you're novice to VFP, just learning remote access you get to perhaps 1% of what is to be learned about FoxPro and you still don't know the application code and are able to maintain and extend it. It just addresses the most pressing problem you seem to have now finding out what DBC to use with remote views for remote access, if you even find one, as there are two other major ways of remote access without remote views, too.

Just notice: Even when an expert VFP developer comes into an existing complex project, to be able to extend it with necessary changes, you need to ask for a chunk of budget to just be able to examine the project and get used to it. Which often enough is the end of the consulting job already.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top