473,657 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

analyzing a csv using sql commands

From a Microsoft article, I got some basic information on using sql
techniques to read a csv file - I am using the code below, which does work.

Unfortuneately, when I try to make the sql statement fancier (select * from
webdata.csv where Name='bj') I get an error. similiar errors occur if I try
to reference the column by name with the datareader (dr.item("Name" ) as
opposed to dr.item(0)).

Though I am experimenting on some small csv files, my eventual goal is to
use something like this to analyze large (400MB) log files.

Any thoughts or additional articles would be a great help.

thanks
-------------------------------------
Public Sub ReadCSVnet()
Dim Conn As OleDbConnection
Dim dr As OleDbDataReader
Dim da As OleDbDataAdapte r
Dim myCommand As OleDbCommand

Dim strPathtoTextFi le As String
Dim sql As String
strPathtoTextFi le = "C:\Data\"
sql = "Select * from webdata.csv"

Conn = New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;" &
"Data Source=" & strPathtoTextFi le & ";" & "Extended
Properties=""te xt;HDR=YES;FMT= Delimited""")

myCommand = New OleDbCommand(sq l, Conn)
Conn.Open()
dr = myCommand.Execu teReader()
While dr.Read
msg.Text += "Name: " & dr.Item(0) & " - "
msg.Text += "occupation : " & dr.Item(1) & "<br>"
End While
dr.Close()
Conn.Close()

End Sub
-------------------------------------
csv file looks like
"name", "occupation "
"bj", "director"
"neil", "web"
bj daniels
da******@gunner y.org
Nov 18 '05 #1
0 927

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

Similar topics

10
11046
by: Frog | last post by:
Hi, i'm not a programmer so I have a very stupid question. I'm trying to make a practical script. I need to run an executable program in it but i can't get it to work. Maybe someone here can figure it out easily: ----- #! /python a = (recipient's e-mail address) pgp -feat a
10
3406
by: Virginia | last post by:
We have a product that runs on Oracle. The version of Oracle I'm working with is 8.1.7. I should also note that I'm relatively new to Oracle. I'm troubleshooting one particular database that is having performance problems when we try to run various quireies and peform inserts or updates. Unfortunately this particular product "requires" that "OPTIMIZER_MODE = RULE".
1
21378
by: Junior | last post by:
I keep receiving this "The type or namespace name 'CASsEventHandler' could not be found (are you missing a using directive or an assembly reference?)" message in two particular lines, and I've tried everything... Could anyone please paste this and tell me what I'm doing wrong ? I use SerialPort.zip, which can be downloaded at http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=b06e30f9-1301-4cc6-ac14-dfe325097c69 ...
2
6559
by: Paul Reddin | last post by:
Hi, (V8.1 Fp2) Our application uses JDBC batch to execute mutiple insert statements and we saw a strange thing this morning. There were 4 SQL Insert statements in the batch, and we know the 2nd would have violated a Unique Constraint and failed, but the SQL error returned was related to the 3rd statement (which had a FK dependent on the 2nd
0
1604
by: Joe Ross | last post by:
(Apologies in advance if there is a better forum for asking advice on this topic). Our ASP.NET application occasionally starts spitting out OutOfMemory exceptions. When this happens, the memory usage for that IIS worker process is over 1GB. I understand in this sceneario that the virtual memory pool can become fragmented and produce this type of exception. This time, however, I was able to do an ADPlus dump while it was in this...
16
3931
by: John Salerno | last post by:
Hi all. I just installed Ubuntu and I'm learning how to use the bash shell. Aside from the normal commands you can use, I was wondering if it's possible to use Python from the terminal instead of the normal bash commands (e.g. print instead of echo). My main reason for asking is that I like using Python for everything, and if I don't need to learn the bash 'language', then I won't just yet. Thanks.
5
2272
by: Johannes Röckert | last post by:
Hi, can anyone help me on how to develop a program in c++ which does single step execution using a callback between the asm commands? I need something like debuggers do - a callback function should be called after each command. I think the resulting code could be fairly small and look somehow like this: static int numCommands = 0; // Var which stores the number of commands
4
7257
by: SPJ | last post by:
Is it possible to run specific commands on cisco router using Python? I have to run command "show access-list" on few hundred cisco routers and get the dump into a file. Please let me know if it is feasible and the best way to achieve this. Thanks, SPJ
3
5106
by: gisto moss | last post by:
i have to implement the shell such that it accepts commands, together with parameters. Assume all possible commands have either 0 or 1 parameter. I need to check this. if(commandstrings.length>2) {output error message and continue to the beginning of the loop} Note: the continue statement will skip all the following lines and go back to the beginning of the while loop. In the skeleton, commandLine=console.readLine(); reads in a command and...
0
8833
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
8737
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...
1
8509
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
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...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
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();...
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
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.