473,443 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to use OPENDATASOURCE to read in text files

3
I am using OPENDATASOURCE to read data from files
when the file extension is txt ,retrieve is successful
Expand|Select|Wrap|Line Numbers
  1. select * 
  2. from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
  3. 'Data Source="c:\files";Extended properties="Text;hdr=no"')...clients#txt
but when the file name type is not txt ,retrieve fails
Expand|Select|Wrap|Line Numbers
  1. select * 
  2. from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
  3. 'Data Source="c:\files";Extended properties="Text;hdr=no"')...clients#aln
  4.  
is it mandatory to use only txt extension ?

thank you
Apr 27 '10 #1
5 8417
ck9663
2,878 Expert 2GB
No, it all depends on the type of file you are reading.Read the full BOL article about OpenDataSource.

Happy Coding!!!

~~ CK
Apr 27 '10 #2
sepgiv
3
both files are the identical .only the extenision name is differant .
i noticed that if the file name is clients#aln the select fails , but if i change the file name to is clients#txt then the select works fine .
by the way where can i find the article you are talking about ?
Apr 29 '10 #3
ck9663
2,878 Expert 2GB
You can find it here...

Happy Coding!!!

~~ CK
Apr 30 '10 #4
sepgiv
3
I have already read this article , it does not explain my problem and does not explain how to solve it . can you tell me what to do ?
thank you
May 2 '10 #5
ck9663
2,878 Expert 2GB
I have tried using other extension before with no problem. But mostly are "CSV, ASC" that usually pertains to text file. Also, ff the pound sign is part of your filename, try using another an underscore.

Good Luck!!!

~~ CK
May 3 '10 #6

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

Similar topics

3
by: raulgz | last post by:
Hi I need create, write and read text files in a procedure transac sql from sql server 2000 How i do this ?? Thanks,
6
by: J. Shrimp, Jr. | last post by:
Following code exports tables as text files: For Each tdf In db.TableDefs StrTblName = tdf.Name Me.txtProgName = StrTblName Me.txtProgName.Requery tblAtt = tdf.Attributes moddate =...
50
by: Michael Mair | last post by:
Cheerio, I would appreciate opinions on the following: Given the task to read a _complete_ text file into a string: What is the "best" way to do it? Handling the buffer is not the problem...
1
by: Aries | last post by:
Hi I need to write programs to read a file and process it with C# in ASP. I need to use C# because other team members which will be joining our team are using C#. Can anyone please show me how...
1
by: Hutty | last post by:
I have a program that open text files and compares them, however, when reading files larger than 500kb the programs seems to bomb. I get re-directed to "page not found". Any idea how to get...
0
by: John | last post by:
I need to create an app to read text files and upload the data into SQL. The text files are in different format so I want to run a method based on the first line of my text files, 1. One of my...
8
by: Zephyre | last post by:
I have some UTF-8 text files written in Chinese to be read. Now the only method that I know to read text from it is to use fopen() function. Thus, I must read the contents byte by byte, change the...
3
by: utab | last post by:
Dear all, What are the advantages of binary files over text files? I would like to search for a specific value of a variable in an output file, I was doing this lately by the string library...
3
by: flavourofbru | last post by:
Hi, I have a question. I know how to read text files using ifstream. Now I would like to append some data at the end of the file. I read a text file as follows: #include "stdafx.h"...
1
by: akalmand | last post by:
Hi there, I am writing a code to read some data from the text files. The number of text files is not fixed and could be more that 15. the length of each file is large... close to 100,000 on an...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
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...
0
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...

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.