[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Vb.net ODBC query from .csv file

Posted on 2011-09-27
6
Medium Priority
?
809 Views
Last Modified: 2012-05-12
Hi,

I am using the following connection string to build a datatable in vb.net:

        Dim conn As New OdbcConnection("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & "\\lettsisa02\DHL Reports\ROSSTEST" & ";Extensions=asc,csv,tab,txt")

My issue is that the column headings contain the first row of data in the .csv file. Is their a setting to turn this off?

Regards,

Ross
0
Comment
Question by:ross13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:DerZauberer
ID: 36708525
You can specify additional options in the connect string to control handling of first row as header.

& ";Extended Properties=""text;HDR=No;FMT=Delimited"""
0
 

Author Comment

by:ross13
ID: 36708943
Hi,

I tried the following but still no joy:

        Dim conn As New Odbc.OdbcConnection("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & "\\lettsisa02\DHL Reports\ROSSTEST" & ";Extended Properties=""text;HDR=No;FMT=Delimited")

Regards,

Ross
0
 
LVL 5

Expert Comment

by:DerZauberer
ID: 36709346
I think i made a mistake, with the Text Driver you can specify ";HDR=No" directly, no need for extended proeprties ... please try like this:

Dim conn As New Odbc.OdbcConnection("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & "\\lettsisa02\DHL Reports\ROSSTEST" & ";HDR=NO")
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:ross13
ID: 36908934
Hi,

I tried it but no luck.

Cheers,

Ross
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36912305
0
 
LVL 5

Accepted Solution

by:
DerZauberer earned 2000 total points
ID: 36924788
Ok, here's another option you have.
You can create a file named "schema.ini" inside your data folder that describes how to handle the data files.

If you have a table file named "table1.txt" f.e. that has semicolon separated values, three columns and you don't want first row to be interpreted as header then your "schema.ini" can look like this:

[table1.txt]
ColNameHeader=False
Format=Delimited(;)
MaxScanRows=0
CharacterSet=OEM
Col1=F1 Char Width 255
Col2=F2 Char Width 255
Col3=F3 Char Width 255

Open in new window


You can use the "ODBC Datasources" in "administrative tools" with the Microsoft Text-Driver and a file dsn to manage the "format definition".
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question