concatenation issue w \0 char

B

Bodo

Hi,

my app imports win32 api SQLConfigDataSourceW(..) that requires attributes
parameter of type string (lpszAttributes).

When my code executes the following line, string ODBC_attributes contains
only the chars from parameter {0} and {1} the rest is missing:

ODBC_attributes = String.Format("{0}={1}\0 {2}={3}\0 ",ODBC_ATTRIB_DSN,
ODBC_DatasourceName , ODBC_ATTRIB_DATABASE, ODBC_Database )

"\0" termination of each key/value pair seems to be required by the api
function.

Can anyone advise on how to use string concatenation with 0-terminate chars?
Appreciate any thoughts.

Thanks in advance.
Bodo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top