Discussion:
Connection - Keeps opening connection wizard windows.
(too old to reply)
Rob
2007-01-13 23:41:15 UTC
Permalink
Every time I run the query bellow or the view created by it
all the connection wizard windows keep opening up - Select datasource
then configure Connection.

Now the connect must be correct because if press OK to everything it
runs the query.

CREATE SQL VIEW mytest CONNECTION Connect1 AS ;
SELECT * FROM Contact


Why is this happening.
Olaf Doschke
2007-01-14 17:32:25 UTC
Permalink
Hi Rob,

CREATE SQL VIEW is for creating a query,
you are not using or running the query.

If you have defined the view you can
simply USE it to run the query.

Do you really have a connection named Connect1
in the foxpro database or an ODBC DSN named
that way?

To what remote database do you connect?
Does it prompt for user/password?

Bye, Olaf.
Rob
2007-01-14 22:47:04 UTC
Permalink
Hi Olaf
Post by Olaf Doschke
Hi Rob,
CREATE SQL VIEW is for creating a query,
you are not using or running the query.
Yes thanks I know that. The problem occurs when I am running or
creating a view.
Post by Olaf Doschke
If you have defined the view you can
simply USE it to run the query.
Do you really have a connection named Connect1
in the foxpro database or an ODBC DSN named
that way?
Yes Connect1 is there
Post by Olaf Doschke
To what remote database do you connect?
Does it prompt for user/password?
Just a directory of free tables
Post by Olaf Doschke
Bye, Olaf.
Thanks for your help Olaf.
Rob
2007-01-14 23:01:14 UTC
Permalink
Hi Olaf

After following your advice and checking that Connect1 was in the DBC,
I opened connect1 again in the connection designer
Display ODBC login prompts from :
"When login information is not specified" to "Never"

Works fine now. Thanks again for your help.

Regards Rob
Post by Olaf Doschke
Hi Rob,
CREATE SQL VIEW is for creating a query,
you are not using or running the query.
If you have defined the view you can
simply USE it to run the query.
Do you really have a connection named Connect1
in the foxpro database or an ODBC DSN named
that way?
To what remote database do you connect?
Does it prompt for user/password?
Bye, Olaf.
Anders Altberg
2007-01-14 17:19:56 UTC
Permalink
Rob,

Try to check Connect1 properties:
DEBUGOUT DBGETPROP( 'Connect1', 'CONNECTION','ConnectString')
to see if looks reasonable, or exists at all.

-Anders
Post by Rob
Every time I run the query bellow or the view created by it
all the connection wizard windows keep opening up - Select datasource then
configure Connection.
Now the connect must be correct because if press OK to everything it runs
the query.
CREATE SQL VIEW mytest CONNECTION Connect1 AS ;
SELECT * FROM Contact
Why is this happening.
Rob
2007-01-14 22:38:02 UTC
Permalink
Hi Anders

This is the output from
DBGETPROP( 'Connect1', 'CONNECTION','ConnectString'):
DSN=The Great Elk;UID=;PWD=;SourceDB=c:\Program
Files\greatelk\VisualElk\Data;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;

(String has obviously been wrapped by my email client)

The connection works. After I click OK to all the previously entered
options the query works fine. VFP 7.0 SP1

Thanks for your help.
Post by Anders Altberg
Rob,
DEBUGOUT DBGETPROP( 'Connect1', 'CONNECTION','ConnectString')
to see if looks reasonable, or exists at all.
-Anders
Post by Rob
Every time I run the query bellow or the view created by it
all the connection wizard windows keep opening up - Select datasource then
configure Connection.
Now the connect must be correct because if press OK to everything it runs
the query.
CREATE SQL VIEW mytest CONNECTION Connect1 AS ;
SELECT * FROM Contact
Why is this happening.
Rob
2007-01-14 22:58:04 UTC
Permalink
I opened connect1 again in the connection designer
Display ODBC login prompts from :
"When login information is not specified" to "Never"

Works fine now. Thanks again for your help.
Post by Rob
Hi Anders
This is the output from
DSN=The Great Elk;UID=;PWD=;SourceDB=c:\Program
Files\greatelk\VisualElk\Data;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;
(String has obviously been wrapped by my email client)
The connection works. After I click OK to all the previously entered
options the query works fine. VFP 7.0 SP1
Thanks for your help.
Post by Anders Altberg
Rob,
DEBUGOUT DBGETPROP( 'Connect1', 'CONNECTION','ConnectString')
to see if looks reasonable, or exists at all.
-Anders
Post by Rob
Every time I run the query bellow or the view created by it
all the connection wizard windows keep opening up - Select datasource
then configure Connection.
Now the connect must be correct because if press OK to everything it
runs the query.
CREATE SQL VIEW mytest CONNECTION Connect1 AS ;
SELECT * FROM Contact
Why is this happening.
Anders Altberg
2007-01-14 23:50:08 UTC
Permalink
Why are you opeinng DBF tables over a VFPODBC connection when you can simply
USE tablename? All views of DBF tables count as local views even if they the
table is stored on a server in Australia, not as remote ODBC views.
BTW, VFPODBC has not been updated since VFP6. It has been replaced since
VFP7 by VFPOLEDB which was updated with a verswion for VFP8 and the latst
for VFP9.
-Anders
Post by Rob
Hi Anders
This is the output from
DSN=The Great Elk;UID=;PWD=;SourceDB=c:\Program
Files\greatelk\VisualElk\Data;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;
(String has obviously been wrapped by my email client)
The connection works. After I click OK to all the previously entered
options the query works fine. VFP 7.0 SP1
Thanks for your help.
Post by Anders Altberg
Rob,
DEBUGOUT DBGETPROP( 'Connect1', 'CONNECTION','ConnectString')
to see if looks reasonable, or exists at all.
-Anders
Post by Rob
Every time I run the query bellow or the view created by it
all the connection wizard windows keep opening up - Select datasource
then configure Connection.
Now the connect must be correct because if press OK to everything it
runs the query.
CREATE SQL VIEW mytest CONNECTION Connect1 AS ;
SELECT * FROM Contact
Why is this happening.
Rob
2007-01-15 08:48:03 UTC
Permalink
Post by Anders Altberg
Why are you opeinng DBF tables over a VFPODBC connection when you can simply
USE tablename? All views of DBF tables count as local views even if they the
table is stored on a server in Australia, not as remote ODBC views.
BTW, VFPODBC has not been updated since VFP6. It has been replaced since
VFP7 by VFPOLEDB which was updated with a verswion for VFP8 and the latst
for VFP9.
-Anders
My program reads data from another program but I need to keep my own
tables I thought that keeping everything in one DBC would make it easy
to keep track of all the files

Using CREATE SQL VIEW doesn't the code becomes a bit unwieldy if you
include the full path of every file you use.

If I add a table to a DBC I find that I cannot access the table for
another project.

I have VFP 7.0 SP1 How do I access VFPOLEDB? I am using the connection
builder
Post by Anders Altberg
Post by Rob
Hi Anders
This is the output from
DSN=The Great Elk;UID=;PWD=;SourceDB=c:\Program
Files\greatelk\VisualElk\Data;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;
(String has obviously been wrapped by my email client)
The connection works. After I click OK to all the previously entered
options the query works fine. VFP 7.0 SP1
Thanks for your help.
Post by Anders Altberg
Rob,
DEBUGOUT DBGETPROP( 'Connect1', 'CONNECTION','ConnectString')
to see if looks reasonable, or exists at all.
-Anders
Post by Rob
Every time I run the query bellow or the view created by it
all the connection wizard windows keep opening up - Select datasource
then configure Connection.
Now the connect must be correct because if press OK to everything it
runs the query.
CREATE SQL VIEW mytest CONNECTION Connect1 AS ;
SELECT * FROM Contact
Why is this happening.
Anders Altberg
2007-01-15 10:02:21 UTC
Permalink
You can have a DBC that contains views of free tables. You don't need to
include the full path if you SET DEFAULT and SET PATH so that VFP knows
where to look.
The connection builder only works for ODBC-based connections.
VFPOLEDB connections cannot be used for views, remote or local - if you
insist on using them in VFP which isn't necessary at all. They are created
as COM objects
x = CreateObject('ADODB.Connection')
There are examples in Help.
The new classes that depend on a ADODB technology are the CursorAdapter and
others. Tricky stuff if you ask me and not fully devedeloped in VFP7.
VFPODBC can be used if the tables do not have any datatypes added in VFP7 or
later.
Again, you can store all your views of free DBF tables in a DBC without
using ODBC at all.
-Anders
Post by Rob
Post by Anders Altberg
Why are you opeinng DBF tables over a VFPODBC connection when you can
simply USE tablename? All views of DBF tables count as local views even
if they the table is stored on a server in Australia, not as remote ODBC
views.
BTW, VFPODBC has not been updated since VFP6. It has been replaced since
VFP7 by VFPOLEDB which was updated with a verswion for VFP8 and the latst
for VFP9.
-Anders
My program reads data from another program but I need to keep my own
tables I thought that keeping everything in one DBC would make it easy to
keep track of all the files
Using CREATE SQL VIEW doesn't the code becomes a bit unwieldy if you
include the full path of every file you use.
If I add a table to a DBC I find that I cannot access the table for
another project.
I have VFP 7.0 SP1 How do I access VFPOLEDB? I am using the connection
builder
Post by Anders Altberg
Post by Rob
Hi Anders
This is the output from
DSN=The Great Elk;UID=;PWD=;SourceDB=c:\Program
Files\greatelk\VisualElk\Data;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;
(String has obviously been wrapped by my email client)
The connection works. After I click OK to all the previously entered
options the query works fine. VFP 7.0 SP1
Thanks for your help.
Post by Anders Altberg
Rob,
DEBUGOUT DBGETPROP( 'Connect1', 'CONNECTION','ConnectString')
to see if looks reasonable, or exists at all.
-Anders
Post by Rob
Every time I run the query bellow or the view created by it
all the connection wizard windows keep opening up - Select datasource
then configure Connection.
Now the connect must be correct because if press OK to everything it
runs the query.
CREATE SQL VIEW mytest CONNECTION Connect1 AS ;
SELECT * FROM Contact
Why is this happening.
Olaf Doschke
2007-01-15 18:16:36 UTC
Permalink
Post by Rob
If I add a table to a DBC I find that I cannot access the table for
another project.
No, that would only be the case, if you add the database to the project.
and have EXCLUSIVE set ON.

While you work in the project, the database would than be open often,
but if you close the treeview nodes of the database, the database will
be closed too.

You should SET EXCLUSIVE OFF, then the database
is not opened twice. Save that as default inTools->Options.

And you should include the database into the EXE, but by default
database and table are excluded of the build.

Then you can add the database to many projects for
convenience of browsing the tables.

Bye, Olaf.
Rob
2007-01-24 11:40:09 UTC
Permalink
Post by Olaf Doschke
Post by Rob
If I add a table to a DBC I find that I cannot access the table for
another project.
No, that would only be the case, if you add the database to the project.
and have EXCLUSIVE set ON.
While you work in the project, the database would than be open often,
but if you close the treeview nodes of the database, the database will
be closed too.
You should SET EXCLUSIVE OFF, then the database
is not opened twice. Save that as default inTools->Options.
And you should include the database into the EXE, but by default
database and table are excluded of the build.
Then you can add the database to many projects for
convenience of browsing the tables.
Bye, Olaf.
Of course! Brilliant! Thank you very much !!!!!!

Regards, Rob
Rob
2007-01-25 10:49:44 UTC
Permalink
Post by Olaf Doschke
Post by Rob
If I add a table to a DBC I find that I cannot access the table for
another project.
No, that would only be the case, if you add the database to the project.
and have EXCLUSIVE set ON.
While you work in the project, the database would than be open often,
but if you close the treeview nodes of the database, the database will
be closed too.
You should SET EXCLUSIVE OFF, then the database
is not opened twice. Save that as default inTools->Options.
And you should include the database into the EXE, but by default
database and table are excluded of the build.
Then you can add the database to many projects for
convenience of browsing the tables.
Bye, Olaf.
No it did not work if I try and add a table to to another DBC it still
spits the dummy.
Olaf Doschke
2007-01-27 09:47:48 UTC
Permalink
Post by Rob
No it did not work if I try and add a table to to another DBC it still
spits the dummy.
I did not talk about adding a table to another
database, I talked about adding the databse to
a project. And I talked about the EXCLUSIVE
setting.

her's an example, which shows you can have
the same database in different projects:

#define ccBasedir "d:\shareddatabasetest\"
Set Exclusive Off
MkDir (ccBaseDir)
MkDir (ccBaseDir+"database\")
MkDir (ccBaseDir+"project1\")
MkDir (ccBaseDir+"project2\")
Create Database (ccBaseDir+"database\shared.dbc")
Close Databases
Create Project (ccBaseDir+"project1\project1.pjx") nowait save
_vfp.ActiveProject.Files.Add(ccBaseDir+"database\shared.dbc")
_vfp.ActiveProject.Close()
Create Project (ccBaseDir+"project1\project2.pjx") nowait save
_vfp.ActiveProject.Files.Add(ccBaseDir+"database\shared.dbc")
_vfp.ActiveProject.Close()
Modify Project (ccBaseDir+"project1\project1.pjx") nowait
Modify Project (ccBaseDir+"project1\project2.pjx") nowait

Now you talk about adding a table. Adding a table needs exclusive
access to a database, so now if two projects are open and
the database is already opened shared, you can't add a table,
true. So pick the database in the project manager treeview and
click on Close to close the database.

Then set exclusive on and open the database in one of the
projects and you can add tables.

It's possible to add a database to several projects and to
have these projects opened parallel. But what I suggest is
to not do so anyway, even that is not the problem, the
handling may not be intuitive and you need to know what
you're doing and what opens the database and what closes
it. CLOSE DATABASE in the command window may not
be enough, if that database node is open, the project manager
keeps the database open and you may not get it exclusive
as easy as you think.

So what I'd suggest is, don't add the database to the projects,
because you'll want to keep that excluded from the EXEs
anyway.

Instead make a third project only containing the database. Now
the problem of projects tending to have their associted database
open as long as the treeview is open from the database node
is no problem anymore, because there is only one project
containing the database.

Maybe this made it clearer.

Bye, Olaf.
Rob
2007-01-29 11:28:29 UTC
Permalink
Post by Olaf Doschke
Post by Rob
No it did not work if I try and add a table to to another DBC it still
spits the dummy.
I did not talk about adding a table to another
database, I talked about adding the databse to a project. And I talked
about the EXCLUSIVE
setting.
her's an example, which shows you can have
#define ccBasedir "d:\shareddatabasetest\"
Set Exclusive Off
MkDir (ccBaseDir)
MkDir (ccBaseDir+"database\")
MkDir (ccBaseDir+"project1\")
MkDir (ccBaseDir+"project2\")
Create Database (ccBaseDir+"database\shared.dbc")
Close Databases
Create Project (ccBaseDir+"project1\project1.pjx") nowait save
_vfp.ActiveProject.Files.Add(ccBaseDir+"database\shared.dbc")
_vfp.ActiveProject.Close()
Create Project (ccBaseDir+"project1\project2.pjx") nowait save
_vfp.ActiveProject.Files.Add(ccBaseDir+"database\shared.dbc")
_vfp.ActiveProject.Close()
Modify Project (ccBaseDir+"project1\project1.pjx") nowait
Modify Project (ccBaseDir+"project1\project2.pjx") nowait
Now you talk about adding a table. Adding a table needs exclusive
access to a database, so now if two projects are open and
the database is already opened shared, you can't add a table,
true. So pick the database in the project manager treeview and
click on Close to close the database.
Then set exclusive on and open the database in one of the
projects and you can add tables.
It's possible to add a database to several projects and to
have these projects opened parallel. But what I suggest is
to not do so anyway, even that is not the problem, the
handling may not be intuitive and you need to know what
you're doing and what opens the database and what closes
it. CLOSE DATABASE in the command window may not
be enough, if that database node is open, the project manager
keeps the database open and you may not get it exclusive
as easy as you think.
So what I'd suggest is, don't add the database to the projects,
because you'll want to keep that excluded from the EXEs
anyway.
Instead make a third project only containing the database. Now
the problem of projects tending to have their associted database
open as long as the treeview is open from the database node
is no problem anymore, because there is only one project
containing the database.
Maybe this made it clearer.
Bye, Olaf.
Hi Olaf,


Thanks for this post, however I will need to read it a number of times.


Points.

1. I using VPF7.0 SP1

2. The tables I am using are free tables in the original application,
however, I am experimenting with copies for testing purposes.

3. I SET EXCLUSIVE OFF , create a DBC add a table.

4. Shut down VFP

5. Start VFP CLOSE DATABASE, CLOSE ALL

6. SET EXCLUSIVE OFF, create new DBC, try an and add the existing table.


Cannot add this table; It belongs to database ................
Anders Altberg
2007-01-29 13:30:10 UTC
Permalink
A table cannot belong to more than 1 database, for several reasons. One
reason is that a table which is added to a database gets the path and name
of that database inserted in the table header. The table knoes which
database it belongs to and the database is opened automatically when the
table is opened.

A database can be included in any number of projects.
-Anders
Post by Rob
Post by Olaf Doschke
Post by Rob
No it did not work if I try and add a table to to another DBC it still
spits the dummy.
I did not talk about adding a table to another
database, I talked about adding the databse to a project. And I talked
about the EXCLUSIVE
setting.
her's an example, which shows you can have
#define ccBasedir "d:\shareddatabasetest\"
Set Exclusive Off
MkDir (ccBaseDir)
MkDir (ccBaseDir+"database\")
MkDir (ccBaseDir+"project1\")
MkDir (ccBaseDir+"project2\")
Create Database (ccBaseDir+"database\shared.dbc")
Close Databases
Create Project (ccBaseDir+"project1\project1.pjx") nowait save
_vfp.ActiveProject.Files.Add(ccBaseDir+"database\shared.dbc")
_vfp.ActiveProject.Close()
Create Project (ccBaseDir+"project1\project2.pjx") nowait save
_vfp.ActiveProject.Files.Add(ccBaseDir+"database\shared.dbc")
_vfp.ActiveProject.Close()
Modify Project (ccBaseDir+"project1\project1.pjx") nowait
Modify Project (ccBaseDir+"project1\project2.pjx") nowait
Now you talk about adding a table. Adding a table needs exclusive
access to a database, so now if two projects are open and
the database is already opened shared, you can't add a table,
true. So pick the database in the project manager treeview and
click on Close to close the database.
Then set exclusive on and open the database in one of the
projects and you can add tables.
It's possible to add a database to several projects and to
have these projects opened parallel. But what I suggest is
to not do so anyway, even that is not the problem, the
handling may not be intuitive and you need to know what
you're doing and what opens the database and what closes
it. CLOSE DATABASE in the command window may not
be enough, if that database node is open, the project manager
keeps the database open and you may not get it exclusive
as easy as you think.
So what I'd suggest is, don't add the database to the projects,
because you'll want to keep that excluded from the EXEs
anyway.
Instead make a third project only containing the database. Now
the problem of projects tending to have their associted database
open as long as the treeview is open from the database node
is no problem anymore, because there is only one project
containing the database.
Maybe this made it clearer.
Bye, Olaf.
Hi Olaf,
Thanks for this post, however I will need to read it a number of times.
Points.
1. I using VPF7.0 SP1
2. The tables I am using are free tables in the original application,
however, I am experimenting with copies for testing purposes.
3. I SET EXCLUSIVE OFF , create a DBC add a table.
4. Shut down VFP
5. Start VFP CLOSE DATABASE, CLOSE ALL
6. SET EXCLUSIVE OFF, create new DBC, try an and add the existing table.
Cannot add this table; It belongs to database ................
Olaf Doschke
2007-01-31 19:33:52 UTC
Permalink
Post by Rob
Cannot add this table; It belongs to database ................
Aahh, you cannot add a table to several databases.

You were talking about projects, not databases, now
I see.

Anders already said, it's impossible.

You could either use the same database in
severl projects or you make local views in
each database to the same free table.

But either way you can use the same table
in different projects.

Bye, Olaf.

Loading...