Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8934353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:45:59+00:00 2026-06-15T09:45:59+00:00

I am having trouble with a certain piece of documentation from MSDN. I am

  • 0

I am having trouble with a certain piece of documentation from MSDN. I am using C++ (or C, rather) to connection to an SQL Server instance via ODBC. Take at the code sample at the bottom of this piece of documentation.

Notice there is a function in the sample called AllocParamBuffer(). The documentation describes what it should do, but doesn’t provide any further help. Could someone please give me a few pointers (no pun intended) as to how I could replicate the definition of this function for this particular case, or, better yet, show it could be done? I’m at a real roadblock, and I can’t find any assistance elsewhere.

Any help would be greatly appreciated.

Thank you for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:46:00+00:00Added an answer on June 15, 2026 at 9:46 am

    You are referring to:

    // Call a helper function to allocate a buffer in which to store the parameter
       // value in character form. The function determines the size of the buffer from
       // the SQL data type and parameter size returned by SQLDescribeParam and returns
       // a pointer to the buffer and the length of the buffer.
       AllocParamBuffer(DataType, ParamSize, &PtrArray[i], &BufferLenArray[i]);
    

    All this does is allocate some memory one presumes with malloc (since the later free calls) to store the input parameter (PtrArray[i]) then set the buffer length BufferLenArray[i] (i.e. the amount of memory allocated for PtrArrayp[i]).

    We’d only be guessing how it calculates how much memory to allocate since the amount required in this case will differ depending on the DataType and ParamSize returned by SQLDescribeParameter. The guess work is down to the fact all the parameters are bound as SQL_C_CHAR and some of them might not be string columns e.g., they could be dates.

    All you need to do is malloc some memory, assign the pointer to PtrArray[i] and set the amount allocated in BufferLenArray[i].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble on a certain piece of a current project and feel like
I'm having trouble using MobileSubstrate's MSHookFunction() to hook certain library function calls. For example,
I'm having trouble playing a certain .3gp file (from a Dropbox link) with Android's
I'm having trouble retrieving the members of a certain group in active directory. The
I'm currently having some trouble with getting certain input fields passed along when a
I am having trouble skipping to a certain point in a Vimeo video clip
I am really having trouble trying to figure out how to find certain records
I'm having some trouble getting a hold of the drawable a certain OverlayItem is
I'm having serious trouble figuring out what is making certain function calls ambiguous and
Having trouble with an .htaccess file on WAMP. Works on the live server, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.