Sql-docs: SQLRETURN SQLDriverConnectW(SQLHDBC,SQLHWND,SQLWCHAR *,SQLSMALLINT,SQLWCHAR *,SQLSMALLINT,SQLSMALLINT *,SQLUSMALLINT)': cannot convert argument 3 from 'SQLCHAR *' to 'SQLWCHAR *

Created on 24 Jan 2021  Â·  6Comments  Â·  Source: MicrosoftDocs/sql-docs

I copied and pasted the code from here https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqldriverconnect-function?view=sql-server-ver15 to Visual Studio 2017. When compile I got the error:

“SQLRETURN SQLDriverConnectW(SQLHDBC,SQLHWND,SQLWCHAR *,SQLSMALLINT,SQLWCHAR *,SQLSMALLINT,SQLSMALLINT *,SQLUSMALLINT)': cannot convert argument 3 from 'SQLCHAR *' to 'SQLWCHAR * “

Any one faces the same issue?

Pri3 assigned-to-author doc-bug sqprod

Most helpful comment

The code compiled and ran correctly when I tried just now, the above mentioned error is usually caused by the project settings. In Visual Studio 17 it is in _Project Properties -> General -> Project Defaults -> Character Set_, if that property is set to "Unicode" one would get that error.

All 6 comments

@chanmmn -- thank you for your feedback. Please consider these resources, and let me know if you find an answer:

Unfortunately, there is nothing relevant at the MS Q&A, DB Stack Exchange and Stack Overflow on this.

@chanmmn -- thank you for your update.

@David-Engel -- please look into this potential documentation issue.

@v-makouz - Can you validate the code sample on this page? Thanks!

The code compiled and ran correctly when I tried just now, the above mentioned error is usually caused by the project settings. In Visual Studio 17 it is in _Project Properties -> General -> Project Defaults -> Character Set_, if that property is set to "Unicode" one would get that error.

@chanmmn I'm going to close the issue now since this doesn't appear to be a doc issue. If the above doesn't work for you, feel free to @ me or v-makouz on here.

please-close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chlafreniere picture chlafreniere  Â·  3Comments

GeorgeTsiokos picture GeorgeTsiokos  Â·  4Comments

eliotg picture eliotg  Â·  3Comments

0ddo picture 0ddo  Â·  4Comments

eliotg picture eliotg  Â·  3Comments