×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Open BTRieve in code with Owner

Open BTRieve in code with Owner

Open BTRieve in code with Owner

(OP)
I need to open a BTRieve file which has the OWNER set in C#.  I know what the owner is I would like to know what to pass through in the 3rd param for the Open (0) operation.  At present I pass through an IntPtr.Zero.

RE: Open BTRieve in code with Owner

(OP)
For the record I have solved it thus:

Create a structure in which to store the Owner Name:

[StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Ansi, Size=8)]
    public struct BTR_OWNER_NAME
    {
        public string OwenerName;
    }

//Declare a struct var:

BTR_OWNER_NAME ownerBuf;

//Assign the constant in which the Owner Name is held (this contains 6 chars):

ownerBuf.OwenerName = OWNER_NAME;

//Pass the length of the Owner Name +1 for the trailing Binary 0 into var:

dataLen = 7;

// move our owner structure into unmanaged memory block
                dataBuffer = Marshal.StringToHGlobalAnsi(ownerBuf.OwenerName);

// and finally issue OPEN (0) operation to Btrieve with the dataBuffer containg the Owner Name:

try
                {
                    bStat = BtrCall.BTRCALL( (ushort)BTROPS.B_OPEN, posBlock, dataBuffer, ref dataLen, keyBuffer, keyLen, keyNum );
                }
                catch( Exception e )

bStat has been assigned 0, so all is fine and the Btrieve file which has an Owner Name set with access level 0 is now open.

RE: Open BTRieve in code with Owner

Fair play to you

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close