From: Rich P on
Here is the oledb connection string which works fine in VB.Net

connOle.ConnectionString = _
& "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\;Extended " _
& "Properties=""text;"HDR=Yes;FMT=TabDelimited"""

I am having problems with the doublde quotes inside the string
..."Properties = ""...""" part. Here is what I tried that is not
working:

connOle.ConnectionString =
+ "Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=C:\\;"
+
"Extended Properties="""text;HDR=Yes;FMT=TabDelimited"""";

Here is the string unparsed:

connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\;Extended Properties="""text;HDR=Yes;FMT=TabDelimited"""";

C# is not liking the inner double quotes. How do I handle this?

Thanks

Rich

*** Sent via Developersdex http://www.developersdex.com ***
From: Rich P on
I think I handled it. I escaped the inner double quotes with a
backslash before each double quote. C# stopped complaining. Now I just
hope my thing runs.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
From: Arne Vajhøj on
On 11-01-2010 18:47, Rich P wrote:
> Here is the oledb connection string which works fine in VB.Net
>
> connOle.ConnectionString = _
> & "Provider=Microsoft.Jet.OLEDB.4.0;" _
> & "Data Source=C:\;Extended " _
> & "Properties=""text;"HDR=Yes;FMT=TabDelimited"""
>
> I am having problems with the doublde quotes inside the string
> .."Properties = ""...""" part. Here is what I tried that is not
> working:
>
> connOle.ConnectionString =
> + "Provider=Microsoft.Jet.OLEDB.4.0;"
> + "Data Source=C:\\;"
> +
> "Extended Properties="""text;HDR=Yes;FMT=TabDelimited"""";
>
> Here is the string unparsed:
>
> connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=C:\\;Extended Properties="""text;HDR=Yes;FMT=TabDelimited"""";
>
> C# is not liking the inner double quotes. How do I handle this?

VB.NET "bla "" bla" can be done in C# as "bla \" bla" and
@"bla "" bla".

Arne
From: Jeff Johnson on
"Arne Vajh�j" <arne(a)vajhoej.dk> wrote in message
news:4b4bbcbb$0$280$14726298(a)news.sunsite.dk...

>> C# is not liking the inner double quotes. How do I handle this?
>
> VB.NET "bla "" bla" can be done in C# as "bla \" bla" and
> @"bla "" bla".

The extra warning being that if you use the @"..." syntax you lose ALL
backslash escape sequences, so you can't directly include tabs, for example.


From: Arne Vajhøj on
On 11-01-2010 19:13, Jeff Johnson wrote:
> "Arne Vajh�j"<arne(a)vajhoej.dk> wrote in message
> news:4b4bbcbb$0$280$14726298(a)news.sunsite.dk...
>
>>> C# is not liking the inner double quotes. How do I handle this?
>>
>> VB.NET "bla "" bla" can be done in C# as "bla \" bla" and
>> @"bla "" bla".
>
> The extra warning being that if you use the @"..." syntax you lose ALL
> backslash escape sequences, so you can't directly include tabs, for example.

If your editor supports it then you can enter a literal tab
in the string.

I will not recommend it though.

Arne
 |  Next  |  Last
Pages: 1 2
Prev: JIT Debugging
Next: Kill Process in Application Setup?