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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Paradox8; Query from Network files

Status
Not open for further replies.

paulvos

Technical User
Aug 1, 2001
8
NL
I use paradox8 installed on a W2000 PC. I am connected to a server running WinNT4 SP6. Workstation and server both use NTFS.

I am writing an application using Method pushbutton in the WORK alias on my PC, which needs to query a DBF file in the server.

If I create the Query by hand I get good result. If I run the Query from the method it gives no answer. What way should I name Drive, directory and database on the server?
 
When you do the query by hand you are selecting the table by browsing to it, however your form will only look in the working directory. You can change your working directory to the network drive and place your form there or else use an alias to tell your form where the table is eg. addalias("aliasname","standard","\\\\server\\folder"), then use the alias in your query
q = query

:aliasname:table.dbf | field | ....
| check |....
endquery

etc..

HTH,
Richie

 
Richie,

Thanks for taking the trouble to answer to my problem. Your suggestion looked very promising, so I tried it inmediatly. However it was unsuccesfull.

The command I used was:

addalias("Archie","Standard","\\\\Elquip bv\\server\\Archie8\\data")

I am now wondering:
- is the server path case-sensitive?
- am I limited to the old DOS 8 characters for the servername?

when I simply test with
addAlias("Sales", "standaard", "\\\\elquip bv\\server\\Archie8\\Data")

Salesinfo.open(":Sales:sales001.dbf")

The result is an error stating "the alias :Sales:sales001.dbf has not been defined
 
I'm assuming "standaard" is a typo and not copied and pasted from your code.
Try adding
if not addalias("Sales", "standard", "\\\\elquip bv\\server\\Archie8\\Data") then
errorshow()
endif
if not Salesinfo.open(":Sales:sales001.dbf") then
errorshow()
endif


and see if you get any error messages. This is good practice anyway since servers may be down or users may not be logged in etc.

Also, after the code is run you can go to alias manager and see if the alias exists.
HTH,
Richie
 
Dear Richie,

Your suggestions to add the checks errorshow() have helped me to pinpoint the problem. The code:

addAlias("Sales", "standard", "\\\\elquip bv\\server\\Archie8\\Data")
If not addalias ("Sales", "standard", "\\\\elquip bv\\server\\Archie8\\Data")
Then errorshow()
Endif

results in no errors and I can find the alias Sales in my Project viewer. However the following code:

If not Salesinfo.open(":Sales:Sal001.dbf")
Then errorshow()
Endif

Does result in an error message saying the the alias :Sales:Sal001.dbf 'has not been defined'

I have checked if I can find the file by hand using the alias from the Project viewer. It does exist and I can open it.

Can you give me any further hints? Thanks in advance for your patience
 
You got me. Can you post the offending code?
Maybe something will jump out at me.

Richie
ps. you refer to the table as sal001.dbf in the latest post and sales001.dbf earlier. Is this just in your posts or is the typo in your code?



 
Dear Richie,

Thank you for your patience. You've been a great help. The mixup in names (sal001.dbf or sales001dbf) was indeed a typo.

Please find the complete code below. You will notice there is a lot of extra string definitions which are not used yet. They are meant for the rest of the code I still have to add. I have assumed it doesn't interfere to leave them in. Here is the code you requested:

method pushButton(var eventInfo Event)

Var
Salesinfo Database
Verkoop String
Sales String
Date1 String
Date2 String
cDate1 Date
cDate2 Date
RepV Report
Info1 ReportPrintInfo
Info2 ReportPrintInfo
qVar Query
Endvar

addAlias("Sales", "standard", "\\\\elquip bv\\server\\Archie8\\Data")
If not addalias ("Sales", "standard", "\\\\elquip bv\\server\\Archie8\\Data")
Then errorshow()
Endif

;Salesinfo.open(":Sales:sal001.dbf")
If not Salesinfo.open(":Sales:Sal001.dbf")
Then errorshow()
Endif

endMethod

Hopefully you find something.
 
Salesinfo is a database variable so you can't use it to open a table (see help system).
Use a tCursor instead. Also you are creating the alias twice.
>>
addAlias("Sales", "standard", "\\\\elquip bv\\server\\Archie8\\Data")
If not addalias ("Sales", "standard", "\\\\elquip
bv\\server\\Archie8\\Data")
Then errorshow()
Endif
<<
If it fails you won't see the error. Get rid of the first line.

Richie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top