473,763 Members | 3,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pull info from a csv file using C#

2 New Member
Hello! I'm hoping someone might be able to help me. I am writing a program that pulls info from a csv file and imports into an oracle table. Right now all I'm trying to do is connect to the csv file (it's on my computer) so that I can pull the data out. But no matter what I try I get an error. Can u please tell me what I'm doing wrong? Everything commented out is code I've tried and hasn't worked.

private static void PullRecords (string csvFile)
{
//string connString = @"Driver={Micro soft Text Driver (*.txt;*.csv)}; Dbq="+csvFile+" ;Extensions=csv ;";
//string connString = @"Driver={Micro soft Text Driver (*.txt; *.csv)};Dbq="+c svFile+";Extens ions=asc,csv,ta b,txt;";
//string connString = @"Provider=SQLO LEDB; Data Source=C:\new_t ickets.csv;";

string selectString;

System.Data.Odb c.OdbcConnectio n conn;
//System.Data.Ole Db.OleDbConnect ion conn;
System.Data.Odb c.OdbcDataAdapt er adapt;
//System.Data.Ole Db.OleDbDataAda pter adapt;

// Create connection to csv file
conn = new System.Data.Odb c.OdbcConnectio n(connString.Tr im());
//conn = new System.Data.Ole Db.OleDbConnect ion(connString. Trim());

// Open the connection
conn.Open();

...code...

// Close connection to csv file
conn.Close();
}
Dec 23 '06 #1
1 5658
katy07
2 New Member
Nevermind, I figured it out. I guess all it took was asking for me to find my error...


Hello! I'm hoping someone might be able to help me. I am writing a program that pulls info from a csv file and imports into an oracle table. Right now all I'm trying to do is connect to the csv file (it's on my computer) so that I can pull the data out. But no matter what I try I get an error. Can u please tell me what I'm doing wrong? Everything commented out is code I've tried and hasn't worked.

private static void PullRecords (string csvFile)
{
//string connString = @"Driver={Micro soft Text Driver (*.txt;*.csv)}; Dbq="+csvFile+" ;Extensions=csv ;";
//string connString = @"Driver={Micro soft Text Driver (*.txt; *.csv)};Dbq="+c svFile+";Extens ions=asc,csv,ta b,txt;";
//string connString = @"Provider=SQLO LEDB; Data Source=C:\new_t ickets.csv;";

string selectString;

System.Data.Odb c.OdbcConnectio n conn;
//System.Data.Ole Db.OleDbConnect ion conn;
System.Data.Odb c.OdbcDataAdapt er adapt;
//System.Data.Ole Db.OleDbDataAda pter adapt;

// Create connection to csv file
conn = new System.Data.Odb c.OdbcConnectio n(connString.Tr im());
//conn = new System.Data.Ole Db.OleDbConnect ion(connString. Trim());

// Open the connection
conn.Open();

...code...

// Close connection to csv file
conn.Close();
}
Dec 23 '06 #2

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

Similar topics

11
2060
by: Mike | last post by:
I need to be able to pull the current <Title> tag from the header into the body of the html page. We started coding this with php, and we were able to get it working. However the entire page is being parsed and really bogging down the system and the pages load very slowly. (the system is Dual P4 2.4, 1GB ram, Redhat 9.0) To fix this we decided to just use javascript, which worked great. Text loaded immediately. However, search engines will...
1
1878
by: Kenshin | last post by:
Hey! I have another script where i pull all the information from the database and I want to send it to the person. What they do is they enter in their email, and if the email matches, than it will email them their login information. How do you grab the info and than use that info and put it into an email to send? Here is my code thus far for it:
0
1368
by: Patrick Crowley | last post by:
I'm creating a tool to browse a database of movie listings. The browser pulls up 25 results at a time, and you can page through them using 'Next' and 'Prev' tools. Pretty basic stuff. Here are my tables: movies directors comments movies_directors movies_comments
5
4777
by: Glenn Mulno | last post by:
Hi, I am trying to create a report page for several teams. Each team runs the same reports but the reports use different values. For a while this was getting insane everytime I updated the queries I had to change them in many places. Then I started using server side includes to keep me from changing some items in multiple places. There is still some double (quadruple) updating going on though when I make
5
7256
by: Julia Baresch | last post by:
Hi everyone, I haven't found any reference to this problem on this group or in Access 97 help. I hope someone here knows this - probably a simple thing, but not obvious. I designed a query to pull payment data from my database for accounting. It has 3 tables with one-to-many joins: Table1 --> one-to-many --> Table2 --> one-to-many --> Table3 The payment amount field is in Table3. I entered a few negative
4
1360
by: Dave | last post by:
I am saving a class by giving it the "Serializable" attribute, and calling Serialize. Is there a way that I can pull the value of an individual member of the class, out of the resulting xml file, without constructing a new instance of the class deserializing the file into it? In this case, I just need the value of a string member, and don't want to construct the entire class to get it.
1
1692
by: dkimbrell | last post by:
Hi there, I'm very novice to web design. I'm trying to make a pulldown menu, but the formatting keeps getting screwed up when you roll the mouse over it. Please see www.boundarysys.com for what I'm talking about. Before the mouse touches the pulldown, the vertical height of the menubar is perfect. As soon as the mouse rolls over it, it expands to about twice the height.
5
1770
by: The Cool Geek | last post by:
I'm building a dynamic site that has 3 data bases. One DB contains all of my store info ID#, Name, Address, Phone. Another DB contains member info ID, Name, address, email,phone,etc... The 3rd DB Tracks when a user logs in and logs out at a store. This DB has the following columns Store ID, Member ID, log in time,log out time, time in store. The stores log in in the morning that starts a session-I need the session to pull the store's...
4
1941
by: sparks | last post by:
We have a new project here, one that I have never tried maybe its easy I don't know yet. We have people that have records dating back over 5 yrs on a sql server. We have to build an access 2003 database for data entry of the people then pull data from the sql server to fill in data for these records. that sounds good....except to start I need record # and date....no problems there.
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10145
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
9998
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
9822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
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...
0
6642
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
5270
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...
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.