PC Review


Reply
Thread Tools Rate Thread

concatenation issue w \0 char

 
 
Bodo
Guest
Posts: n/a
 
      8th Apr 2009
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



--
Thanks in advance
Bodo
 
Reply With Quote
 
 
 
 
Cesar
Guest
Posts: n/a
 
      8th Apr 2009
Use @ at beggining of the string:
@"test test \0 \1 \w \etc"




"Bodo" <(E-Mail Removed)> wrote in message
news:E607A467-6ECE-48EC-99AD-(E-Mail Removed)...
> 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
>
>
>
> --
> Thanks in advance
> Bodo



 
Reply With Quote
 
Bodo
Guest
Posts: n/a
 
      8th Apr 2009
Great, many thanks, works perfect now!


--
Thanks in advance
Bodo


"Cesar" wrote:

> Use @ at beggining of the string:
> @"test test \0 \1 \w \etc"
>
>
>
>
> "Bodo" <(E-Mail Removed)> wrote in message
> news:E607A467-6ECE-48EC-99AD-(E-Mail Removed)...
> > 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
> >
> >
> >
> > --
> > Thanks in advance
> > Bodo

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to permanently delete char char char char style in MS Word? =?Utf-8?B?Q3Jpcw==?= Microsoft Word Document Management 6 12th Jun 2011 09:47 PM
String concatenation issue tcomer Microsoft C# .NET 2 28th Nov 2006 05:10 AM
Ever seen "Char Char Char Char Char Char1 Char Char Ch" style? =?Utf-8?B?TWFyaWx5bg==?= Microsoft Word Document Management 2 4th Oct 2006 04:47 PM
Concatenation issue - Help, PLEASE! =?Utf-8?B?UlVTSDJDUk9DSEVU?= Microsoft Excel Misc 2 18th Oct 2005 11:15 PM
Concatenation of text field of table (size > 50 char)with other st =?Utf-8?B?QWJkdWwgQmFzaXQ=?= Microsoft Access Reports 1 15th Jun 2005 12:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:22 AM.