473,402 Members | 2,055 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,402 software developers and data experts.

JET.OLEDB: how to access columns without names in a csv txt

2
I didn't know where to place this issue, because it either C# or .net or I don't know. So I placed it here so it can be moved by an admin.

Hello.
I'm using c# and OleDb to access a txt (comma separated values) file which has this format:

05223,1.5
05548,4.9

It doesn't have header, so when I use an OleDbCommand with this query:
("select * from "+ System.IO.Path.GetFileName(filePath),conn)
I get:
ds.Table[0].Rows[0][0] = 5223
ds.Table[0].Rows[0][1] = 1.5
But I need a string (starting whit zero). I mean that first field should be 05223.

I tried changing the query:
("select cast([0] as nvarchar(64)), [1] from "+ System.IO.Path.GetFileName(filePath),conn)
But it doesn't work.

Does anyone knows how to leave that first field into string?

Thanks,
Pehuén.
Jan 26 '09 #1
1 2255
pehuen
2
Hello.
I'm using c# and OleDb to access a txt (comma separated values) file which has this format:

05223,1.5
05548,4.9

It doesn't have header, so when I use an OleDbCommand with this query:
("select * from "+ System.IO.Path.GetFileName(filePath),conn)
I get:
ds.Table[0].Rows[0][0] = 5223
ds.Table[0].Rows[0][1] = 1.5
But I need a string (starting whit zero). I mean that first field should be 05223.

I tried changing the query:
("select cast([0] as nvarchar(64)), [1] from "+ System.IO.Path.GetFileName(filePath),conn)
But it doesn't work.

Does anyone knows how to leave that first field into string?
I believe the query should be different, the file should be red differently. (¿?)

Thanks,
Pehuén.
Jan 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: | last post by:
Hi, I was performing SQL UPDATE queries and I notice that they SUCCEED on the ExecuteNonQuery() call with NO exceptions raised BUT they fail at the Database. They say they succeed in the code...
14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
2
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
5
by: premmehrotra | last post by:
I am using Microsoft Access 2000 and Oracle 9.2.0.5 on Windows 2000. When I export a table from Access to Oracle using ODBC I get error: ORA 972 identifier too long I think the error is because...
3
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I...
8
by: erin.sebastian | last post by:
Hi all, I have a really silly problem that i can't find the answer too. I am working with VB.NET and i am trying to insert a new record into my access database (pretty easy right?) well i am...
0
by: Mythran | last post by:
I can get the column names and OleDbType enumeration value for any given table using VB.Net and the OleDb namespace classes. Is there a way for me to get the Access alias/name of the data type? I...
4
by: SAL | last post by:
Hello, I am using OLEDB to access Excel, and what I have read you can access Named Ranges but I am having trouble doing so. The following are lines of code I've tried in my C# program to access...
0
by: mwenz | last post by:
I am trying to update an Access table using OLEDB in VB.Net 2005. I can add rows but I cannot update them. Code to instantiate the Access database and table... Dim conn As New...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.