473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Whats wrong with this line?

I cant get this to work in C#. It works in VB.NET.

OleDbConnection Conn = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + FilePath +
";Extended Properties=""text;HDR=NO;FMT=Delimited""");

FilePath = "C:\\ftproot\\TOG\\"


Nov 15 '05 #1
3 2229
Ruslan Shlain wrote:
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" +
FilePath + ";Extended Properties=""text;HDR=NO;FMT=Delimited""");


Try this:

OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" +
FilePath + ";Extended Properties=\"text;HDR=NO;FMT=Delimited\"");

Note the escaped double quotes.
--
gabriel
Nov 15 '05 #2
This worked just fine. Thank you. I am very new to C#. Its my first day. Why
did i have to use the \ ?
"gabriel" <no@no--spam.com> wrote in message
news:83***************************@msgid.meganewss ervers.com...
Ruslan Shlain wrote:
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" +
FilePath + ";Extended Properties=""text;HDR=NO;FMT=Delimited""");


Try this:

OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" +
FilePath + ";Extended Properties=\"text;HDR=NO;FMT=Delimited\"");

Note the escaped double quotes.
--
gabriel

Nov 15 '05 #3
Ruslan Shlain wrote:
This worked just fine. Thank you. I am very new to C#. Its my first
day. Why did i have to use the \ ?


That is how you place normally "illegal" characters in a string. For
example, you had to use \\ instead of \ in your string because using a
single \ gave you an error.

You could also say something like a = @"c:\t\1\2\3" without a problem
because the @ tells c# that you are not using excape sequences, so it
does not require double backaslashes.

There are several other escape sequences, for example \r\n for a carriage
return/life feed pair. You should read up on these, they are powerful to
use.

Glad to help.

--
gabriel
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Colin Steadman | last post by:
I have created a function to kill all session variables that aren't in a safe list. This is the function - Sub PurgeSessionVariables For Each Item In Session.Contents Select Case Trim(Item)...
4
by: asdf | last post by:
Hello! Can someone tell me whats wrong with this piece of code: Option Compare Database Option Explicit Sub retrieve() Dim rst As ADODB.Recordset Dim i As Integer
1
by: aa | last post by:
When I am reading from local disk (d:), everithing is OK, but then I am reading from map disk I am geting the this error. Whats wrong. Thanks Server Error in '/Extra' Application....
3
by: Vaidas Gudas | last post by:
I has web project on virtual pc, maked with framework 2.0. there I was used the method role.roleexists("admin") and everything was worked good. but when i replace this project on my local machine,...
0
by: Jim Andersen | last post by:
I am using Microsoft.ApplicationBlocks.Data (v 2.0.0.0). I have this parameter array I pass to a stored procedure. The last one is an output parameter. So I did this: Line 1: arParms(8) = New...
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
1
by: Abubakar | last post by:
Hi, In my application, Some of my thread gets stuck somewhere. The vs2k5 debugging "Thread" window shows that stuck thread and I can I dentify it. In its Name column the following text is...
2
by: abubakarm | last post by:
Hi, There is a strang bug appearing not-so-often in my application. I'm pasting the stack calls window contents when my app crashes. Following it is: msvcr80d.dll!fastcopy_I(void *...
1
by: Varun Gupta | last post by:
PATH="/clocal/mqbrkrs/user/mqsiadm/sanjay/" MAIL_RECIPIENTS="rb903@dcx.com" Subject="File accessed in last minutes:" find "$PATH" -type f -amin -1 > temp.txt.$$ cat temp.txt.$$ | \ while read...
5
by: hiqu | last post by:
This issue is driving me nuts and not able to figure out whats wrong. I've this code in my firefox extension. Firefox always hangs and reports the script is busy. if I introduce a break...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.