473,769 Members | 6,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Whats wrong with this line?

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

OleDbConnection Conn = new
OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=" + FilePath +
";Extended Properties=""te xt;HDR=NO;FMT=D elimited""");

FilePath = "C:\\ftproot\\T OG\\"


Nov 15 '05 #1
3 2245
Ruslan Shlain wrote:
OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=" +
FilePath + ";Extended Properties=""te xt;HDR=NO;FMT=D elimited""");


Try this:

OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=" +
FilePath + ";Extended Properties=\"te xt;HDR=NO;FMT=D elimited\"");

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.mega newsservers.com ...
Ruslan Shlain wrote:
OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=" +
FilePath + ";Extended Properties=""te xt;HDR=NO;FMT=D elimited""");


Try this:

OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=" +
FilePath + ";Extended Properties=\"te xt;HDR=NO;FMT=D elimited\"");

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
3470
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) Case "Authenticated" Case "CI_CODE" Case "organisation_description" Case "location_description"
4
4065
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
2464
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. ---------------------------------------------------------------------------- ---- The specified user does not exist. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more...
3
1762
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, where is installed both versions 1.1 and 2.0 of framework. And on the this method I am getting the error System.Web.HttpException was unhandled by user code ErrorCode=-2147467259 Message="Unable to connect to SQL Server database."...
0
1043
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 SqlClient.SqlParameter("@MyParam", SqlDbType.Int, 4, ParameterDirection.Output) Line 2: arParms(8).Direction = ParameterDirection.Output
7
2231
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 me why? Its probably sooooooo obvious, but it is 1.19 am! Thanks. www.thunderin.co.uk/
1
7554
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 written: "std::_Container_base::_Orphan_all". What does this mean? Now some general info about whats happnening here: :this is a call to a SendMessage api, which I'm sending to my GUI window, and this call never makes it back. I have checked the GUI...
2
2857
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 * dst=0x01e46130, void * src=0x00001280, int len=0) + 0x4b bytes C msvcr80d.dll!_VEC_memcpy(void * dst=0x01e46130, void * src=0x000012fc, int len=8) + 0x52 bytes C
1
1942
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 line do fuser -uV $line >> tempmail.txt done
5
1721
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 statement in the for(;;) loop below, then no issue. Any help would be appreciated! function getStuff()
0
10211
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.