Solved

In vb6 with  pervasive sql, then call  file with other filename , but same tablename in ddf

Posted on 2011-02-13
7
640 Views
Last Modified: 2012-05-11
I open files like this and works ok"
even if in the table.ddf  the filename is defined as:  MUT.PVW

With vMUT
.Close
.DatabaseName = "J:\PDS\MUT{H05.H05
.Location = .DatabaseName
 Status% = .Open
 .IndexNumber = 2
 Status% = .GetFirst
While Status% = 0
 Debug.Print .FieldValue(0)
 Status% = .GetNext
Wend
end with

So the MUT{h05.h05 is seen this way.
Only using SQL gives a error if file opened is different then in table
 when I call like:   select * from mutaties  
if MUT.PVW exist (wich is in table.ddf the name off file)  no problem
but if not,
 and still did the first lines with opening this file MUT{H05.H05  I get error

I there something I can do in the SQL statement to set direction to the other filename using the default table
(else create for every instance a definition in the table , and if can I do that from VB6 , copying the table ?)


 
0
Comment
Question by:BIAPRO
  • 4
  • 3
7 Comments
 
LVL 28

Expert Comment

by:Bill Bach
Comment Utility
Yes -- the command is ALTER TABLE tabelname IN DICTIONARY USING 'filename';

This will point your existing definition to a new data file.
0
 

Author Comment

by:BIAPRO
Comment Utility
This i do on real file mut.pvw, no error
select * from mutaties  where mutboek = '60'  and mutrek <> '1300'  order by mutstuk

then
select * from mutaties  where mutboek = '60'  and mutrek <> '1300'  order by mutstuk,  ALTER TABLE 'MUTATIES' IN DICTIONARY USING 'MUT{H05.H05'

with or without de ,   before the word ALTER  will generate error
0
 
LVL 28

Accepted Solution

by:
Bill Bach earned 500 total points
Comment Utility
Please look in the SQL Language Reference manual for more info.
The ALTER TABLE statement needs to be issued separately when nobody else is accessing that table from SQL.
You cannot just add it to an existing statement.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:BIAPRO
Comment Utility
ok will find out , thanks
0
 

Author Comment

by:BIAPRO
Comment Utility
Ok that works, but also learned that doing this on multi-user platform will be dangerous, due to other users could open that table at same time, so will only use at stand-alone and/or table name wich are in use with 1 person
0
 
LVL 28

Expert Comment

by:Bill Bach
Comment Utility
Exactly correct, as indicated above.  If you need to access numerous files from the SQL layer at the same time, then you should really create a DDF definition for each.  With newer versions of PSQL, you may be able to use the PCC or DDF Builder to Export the table schema, and then use CREATE TABLE ... IN DICTIONARY statements to create the other ones.  Please note, though, that this process is not always perfect, so you may have to verify that what you are doing is working perfectly before you do a lot of them.
0
 

Author Comment

by:BIAPRO
Comment Utility
just wrote a small VB routine wich copies the original table with a new name and add it to the table,  in use software there will a look in a file to see wich tablename to use
thanks
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now