In a VFP9 application, I can use AdsOpenTable to open a table as shared, but not as exclusive. I've verified that neither the current nor other process has the file open and I have full rights to the table. Mark corrected my usage of Connect (by using Connect101 when specifying a Connection String). It appears that I still have the option of using either OpenTable or OpenTable101 with this connection. Using either to open as shared seems to work fine. However, OpenTable does not work when attempting to open exclusive and OpenTable101 does not give me an option to open as exclusive. How do I use Connect101 and yet open a table as exclusive for DBF tables in Compatibility mode?

The current code is as follows: result = AdsSetServerType(1) locCStr = "Data Source='" + inPath + "';" locCStr = locCStr + "ServerType='Local';" locCStr = locCStr + "TableType='VFP';" locCStr = locCStr + "CharType='ANSI';" locCStr = locCStr + "Shared='TRUE';" locCStr = locCStr + "LockMode='COMPATIBLE';" locCStr = locCStr + "DateFormat='MM/DD/YYYY';" locCStr = locCStr + "Epoch='1970';"
locCStr = locCStr + "Decimals='2';" locCStr = locCStr + "Exact='TRUE';" locCStr = locCStr + "ReadOnly='FALSE';" locCStr = locCStr + "TrimTrailingSpaces='TRUE';" locCStr = locCStr + "ShowDeleted='FALSE';" locCStr = locCStr + "SecurityMode='IGNORERIGHTS';" dummy = 0 connHandle = -1 The following returns a good connection as per handle and connection string result = AdsConnect101(locCStr, @dummy, @connHandle) The following works fine, but how do I specify to open for exclusive just for this table? result = AdsOpenTable101(connHandle, "log.dbf", @tbHandle) Alternatively, the following works fine for opening as shared - 4 result = AdsOpenTable(connHandle, inPath + "\log.dbf", "log", 4, 1, 0, 2, 4, @tbHandle) But trying to use the following as an alternative fails with error Advantage server file open failure! result = AdsOpenTable(connHandle, inPath + "\log.dbf", "Alias", 4, 1, 0, 2, 1, @tbHandle)

Thanks

asked 03 Jun '14, 06:14

gverge393's gravatar image

gverge393
126111118
accept rate: 100%

edited 10 Jun '14, 12:38


I'm sorry, I confused things by asking 2 separate questions. Please disregard the first 2 sentences - the question has nothing to do with AdsOpenTable. The question I need answering is about the Connection String - why do I get the AE_INVALID_PATH error ONLY when I enable either of the commented out lines?

Thanks so much.

link

answered 03 Jun '14, 12:01

gverge393's gravatar image

gverge393
126111118
accept rate: 100%

You should be able to edit your original question. There is a link at the bottom of the question that should let you do that.

(03 Jun '14, 13:22) Mark Wilkins

The call to AdsConnect looks incorrect. Perhaps post your API declaration for it. AdsConnect does not accept a connection string. I'm not sure what the API declaration looks like that you are using, but it needs to refer to AdsConnect101. And that API accepts 3 parameters (not 2).

link

answered 03 Jun '14, 13:21

Mark%20Wilkins's gravatar image

Mark Wilkins
7.2k226133
accept rate: 26%

Thank you Mark. That cleared it up for me - using AdsConnect101 accepted my entire Connection String. I just need to open my eyes and use the proper function! The odd thing, though, is that AdsConnect accepted almost all of my Connection String - far more than just the Data Source argument! I think I would have dug deeper myself if it failed with any Connection String arguments. Confusing, but now I understand.

(07 Jun '14, 09:26) gverge393
Your answer to the original question.
If responding to a request for additional information, please edit the question or use the comment functionality.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×172
×24

Asked: 03 Jun '14, 06:14

Seen: 1,835 times

Last updated: 23 Jul '14, 08:24

Advantage Developer Zone Contact Us Privacy Policy Copyright Info


Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.