Skip to content

Update sqlbindcol-function.md#3887

Merged
MightyPen merged 1 commit intoMicrosoftDocs:livefrom
DanielAdeniji:patch-8
Jan 3, 2020
Merged

Update sqlbindcol-function.md#3887
MightyPen merged 1 commit intoMicrosoftDocs:livefrom
DanielAdeniji:patch-8

Conversation

@DanielAdeniji
Copy link
Copy Markdown
Contributor

Please change

#define PHONE_LEN 20

to

#define PHONE_LEN 60

The reason is that in the Northwind.dbo.customers table, the Phone column is defined as nvarchar(24).

Without that change we are getting error that reads
stringData.rightTruncation.01.20200101.1117PM.txt
"String data, right truncation"

Please change

#define PHONE_LEN 20

to

#define PHONE_LEN 60

The reason is that in the Northwind.dbo.customers table, the Phone column is defined as nvarchar(24) 

==============================================================================

Please change SQL_C_CHAR to SQL_C_WCHAR

 retcode = SQLBindCol(hstmt, 1, SQL_C_CHAR, &sCustID, 100, &cbCustID);  
 retcode = SQLBindCol(hstmt, 2, SQL_C_CHAR, szName, NAME_LEN, &cbName);  
 retcode = SQLBindCol(hstmt, 3, SQL_C_CHAR, szPhone, PHONE_LEN, &cbPhone);   

to

retcode = SQLBindCol(hstmt, 1, SQL_C_WCHAR, &sCustID, 100, &cbCustID);  
retcode = SQLBindCol(hstmt, 2, SQL_C_WCHAR, szName, NAME_LEN, &cbName);  
retcode = SQLBindCol(hstmt, 3, SQL_C_WCHAR, szPhone, PHONE_LEN, &cbPhone);   
  
==============================================================================
Also change

wprintf(L"%d: %S %S %S\n", i + 1, sCustID, szName, szPhone);  

to

printf("%d: %ls %ls %ls\n", i + 1, sCustID, szName, szPhone);
@PRMerger16
Copy link
Copy Markdown
Contributor

@DanielAdeniji : Thanks for your contribution! The author(s) have been notified to review your proposed change.

Copy link
Copy Markdown
Contributor

@MightyPen MightyPen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanielAdeniji Hello Daniel, Thank you very much for taking the time and effort to update and correct this aging source code.
I Approve this public PR #3887.

@MightyPen
Copy link
Copy Markdown
Contributor

#sign-off

@MightyPen MightyPen merged commit 082c0d6 into MicrosoftDocs:live Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants