473,385 Members | 1,769 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,385 software developers and data experts.

Connection String error in VB.net

Hi,

When I load a csv file into a dataset with the column containing numeric
data the header name string does not show up .Where as if the data in the
columnis alphanumeric or text then the heading appears.

I have tried thefollowing connection strings
String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source={0};Extended
Properties=""text;HDR=Yes;FMT=Delimited""",
Path.GetDirectoryName(mDataSource))

---------------------

String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source={0};Extended
Properties=Text;", Path.GetDirectoryName(mDataSource))

would appreciate help on this.

thanks is advance

Manoj
Apr 15 '06 #1
3 4132
Ni Manoj

Try this and let me know if it works:

-Make a text file called "schema.ini" and place it in the same
directory of your delimited file mDataSource

-Place the following text into schema.ini

[NameOfYourFile_mDataSource]
ColNameHeader=True
Format=Delimited(,)
MaxScanRows=0

where in place of NameOfYourFile_mDataSource you write the file name of
your
delimited text file (example: [MyText.csv] )

-Run again your program (if delimiter is not a comma change the
schema.ini accordingly)

Manoj Nair ha scritto:
Hi,

When I load a csv file into a dataset with the column containing numeric
data the header name string does not show up .Where as if the data in the
columnis alphanumeric or text then the heading appears.

I have tried thefollowing connection strings
String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source={0};Extended
Properties=""text;HDR=Yes;FMT=Delimited""",
Path.GetDirectoryName(mDataSource))

---------------------

String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source={0};Extended
Properties=Text;", Path.GetDirectoryName(mDataSource))

would appreciate help on this.

thanks is advance

Manoj


Apr 15 '06 #2
hi Tommaso,

The solution worked.
This was needed for a project am currently working on.

Thanks
Manoj

<to**************@uniroma1.it> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Ni Manoj

Try this and let me know if it works:

-Make a text file called "schema.ini" and place it in the same
directory of your delimited file mDataSource

-Place the following text into schema.ini

[NameOfYourFile_mDataSource]
ColNameHeader=True
Format=Delimited(,)
MaxScanRows=0

where in place of NameOfYourFile_mDataSource you write the file name of
your
delimited text file (example: [MyText.csv] )

-Run again your program (if delimiter is not a comma change the
schema.ini accordingly)

Manoj Nair ha scritto:
Hi,

When I load a csv file into a dataset with the column containing numeric
data the header name string does not show up .Where as if the data in
the
columnis alphanumeric or text then the heading appears.

I have tried thefollowing connection strings
String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source={0};Extended
Properties=""text;HDR=Yes;FMT=Delimited""",
Path.GetDirectoryName(mDataSource))

---------------------

String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source={0};Extended
Properties=Text;", Path.GetDirectoryName(mDataSource))

would appreciate help on this.

thanks is advance

Manoj

Apr 15 '06 #3
Good.
It's quite annoying having to resort to the schema.ini file.

Actually I would like to do it programmatically, but so far my attempts
have failed.
IMEX=1 (Intermixed data) in the connection string seems to work only
with EXCEL.

Problem is that the TEXT driver attempts to recognize the type and (by
default) assigns it
based on the mayority of data. Setting MaxScanRows=0 prevents this
scanning and it is forced
to choose "string" for all fields.

If anyone knows a programmatic way, I'd very happy to know...

-tom

Apr 15 '06 #4

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

Similar topics

6
by: Paul Robinson | last post by:
I am developing a website in ASP that connects to a Sybase database. However, when I try to open a connection to the database the page will not load. The script does not timeout, nor the...
17
by: AMC | last post by:
Hi, I'm using an include file to store the connection string to a database. Whenever I try to reference that string to open a connection in the page that includes the file I get the error 'empy...
0
by: JWM | last post by:
I am trying to implement Oracle connection pooling for the following code, which was written by someone else. Here is my main question -- this java file creates code that is executed every hour,...
0
by: Bob | last post by:
I have an ASP.NET web application that has been running without any problems for a while. I recently transferred the site to shared hosting and had multiple users start to use the site. The problem...
8
by: John Smith | last post by:
How do I connect to a FoxPro 7 database?
8
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
0
by: Robert Avery | last post by:
In VBA/VB6, I had a class (incomplete sample below) that watched and displayed for the user all connection events, so that I could easily see what SQL was taking a long time, and when it freezes, I...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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...

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.