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 6656189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:36:44+00:00 2026-05-26T01:36:44+00:00

The example for SQLBindParameter function at http://msdn.microsoft.com/en-us/library/ms710963(v=vs.85).aspx passes the size of the character array

  • 0

The example for SQLBindParameter function at http://msdn.microsoft.com/en-us/library/ms710963(v=vs.85).aspx passes the size of the character array as the ColumnSize argument (6th argument) when the C type is SQL_C_CHAR.

Quoting parts of the examples from that page:

SQLCHAR szEmployeeID[EMPLOYEE_ID_LEN];
SQL_DATE_STRUCT dsOrderDate;
SQLINTEGER cbCustID = 0, cbOrderDate = 0, cbEmployeeID = SQL_NTS;

…

retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT,
                           SQL_C_CHAR, SQL_CHAR, EMPLOYEE_ID_LEN,
                           0, szEmployeeID, 0, &cbEmployeeID);

I want to know if it is okay to pass the length of the string parameter plus 1 as the ColumnSize argument. In other words, I want to know if the following call is okay if we assume that szEmployeeID contains a null-terminated string.

retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT,
                           SQL_C_CHAR, SQL_CHAR, strlen(szEmployeeID) + 1,
                           0, szEmployeeID, 0, &cbEmployeeID);

I believe this can be very useful in calls like these:

SQLLEN nts = SQL_NTS;
retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT,
                           SQL_C_CHAR, SQL_CHAR, 6,
                           0, "hello", 0, &nts);

char *domain = "stackoverflow.com";
retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT,
                           SQL_C_CHAR, SQL_CHAR, strlen(domain) + 1,
                           0, domain, 0, &nts);
  • 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-05-26T01:36:45+00:00Added an answer on May 26, 2026 at 1:36 am

    The answer to this question is “Yes”.

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

Sidebar

Related Questions

Example code: http://jsbin.com/eqile3/ This is a slider with 2 handles, 1 for min and
Example client put this on their website <script type=text/javascript src=http://domain.com/banner.php?bid=123&affid=88></script> In my banner.php how
Example Page: http://kian02.comlu.com/kian3.html I want the Navi in the example page to have mouseover
Example RSS feed link: http://twitter.com/statuses/user_timeline/twitter.rss Does anyone know if Twitter limits calls to a
example: http://jsbin.com/ofifiy/2/edit#preview i try to scroll a div (red one) with a non scrollable
example: I want to see if array[5] holds a value or is empty.
Example in Unix module: val environment : unit -> string array Why not just:
example: class Vendor_ClassName_Helper { CONST FIRST_OPTION = 1; CONST SECOND_OPTION = 2; public function
Example: $arr = array(1 => 'Foo', 5 => 'Bar', 6 => 'Foobar'); /*... do
The function is SQLRETURN SQLBindParameter( SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT InputOutputType, SQLSMALLINT ValueType, SQLSMALLINT

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.