473,856 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

import data from csv file

a
Dear friends

I want import data from CSV file to mdb file How can I do that in vb.net?
Jul 26 '08 #1
9 5797
On Jul 26, 4:50*am, "a" <a...@a.netwrot e:
Dear friends

I want import data from CSV file to mdb file How can I do that in vb.net?
ADO.NET

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jul 26 '08 #2
a
tell me the steps (the answer)
Thank you
"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:00******** *************** ***********@34g 2000hsf.googleg roups.com...
On Jul 26, 4:50 am, "a" <a...@a.netwrot e:
Dear friends

I want import data from CSV file to mdb file How can I do that in vb.net?
ADO.NET

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jul 27 '08 #3
No one is likely to do that. You haven't specified the problem completely
enough for anyone. For example, are the columns of data well defined or do
you need to determine them at runtime by reading the CSV first? You are
more likely to get an answer if you show where you are stuck in your code.
If you ask for the entire answer without showing your attempt, it will be
more likely for others to think you simply want your homework done for you.

By the way, please don't multipost. There are other answers on
..Dotnet.Genera l where you asked this.

"a" <a@a.netwrote in message
news:O7******** ********@TK2MSF TNGP02.phx.gbl. ..
tell me the steps (the answer)
Thank you
"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:00******** *************** ***********@34g 2000hsf.googleg roups.com...
On Jul 26, 4:50 am, "a" <a...@a.netwrot e:
>Dear friends

I want import data from CSV file to mdb file How can I do that in vb.net?

ADO.NET

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jul 27 '08 #4
First off, community support does not exist to solve your every
problem with no work from you. In general, I will give you (or
whoever) enough guidance to get started on the path to the solution,
but I will not do it for you, otherwise you will never learn. With
that said, I will honor your request and give you the steps you
requested, in a sarcastic tone.

Steps:

1) Buy a book on ADO.NET
2) Apply what you have learned to fix your problem.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jul 27 '08 #5
by just having a look at the code project web site and searching CSV you can
find what you are looking for
"a" <a@a.netwrote in message news:O7******** ******@TK2MSFTN GP02.phx.gbl...
tell me the steps (the answer)
Thank you
"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:00******** *************** ***********@34g 2000hsf.googleg roups.com...
On Jul 26, 4:50 am, "a" <a...@a.netwrot e:
>Dear friends

I want import data from CSV file to mdb file How can I do that in vb.net?

ADO.NET

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jul 28 '08 #6
a
Dear friends

I'm not strong vb.net programmer I'm just take course and I want to learn
from you

And I have Excellent knowledge of access 2003 (Expert)

In access 2003 to import data from CSV file you just select file import and
select text

And all CSV file will import in a new table with some steps with the wizard

know I want just import data from CSV file to Access using VB.NET

by button in vb.net form just click this button the vb.net imports data from
csv file to access mdb file

Mr. Paul

Microsoft MVP (Visual Basic)

give me this code :

Dim AccessConn As New
System.Data.Ole Db.OleDbConnect ion("Provider=M icrosoft.Jet.OL EDB.4.0;"
& _
"Data Source=C:\Test Files\db1 XP.mdb")

AccessConn.Open ()

'New table
Dim AccessCommand As New System.Data.Ole Db.OleDbCommand ("SELECT *
INTO [TextFileTable] FROM
[Text;DATABASE=C :\Documents and Settings\...\My Documents\My
Database\Text].[Textfile.txt]",
AccessConn)
'Existing table
'Dim AccessCommand As New System.Data.Ole Db.OleDbCommand ("INSERT
INTO [TextFileTable] (F1,
F2, F3, F4, F5) SELECT F1, F2, F3, F4, F5 FROM [Text;DATABASE=C :\Documents
and Settings\...\My
Documents\My Database\Text].[Textfile.txt]", AccessConn)

AccessCommand.E xecuteNonQuery( )
AccessConn.Clos e()

But there is error in the code I can't benefit form this code

The error in sql code

I'm edit this code like this but also there is error in sql code:

Dim cn As New OleDbConnection

cn.ConnectionSt ring = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=test.mdb ;Persist Security Info=False"

cn.Open()

Dim cmd As New OleDbCommand

cmd.CommandText = ("SELECT * INTO [TextFileTable] FROM [Text;DATABASE=
E:\a.csv]")

cmd.Connection = cn
cmd.ExecuteNonQ uery()

cn.Close()

==

Can you edit the code for me







"Gillard" <gillard_george s@@@@@@@@@hotma il.comwrote in message
news:OM******** ******@TK2MSFTN GP02.phx.gbl...
by just having a look at the code project web site and searching CSV you
can find what you are looking for
"a" <a@a.netwrote in message
news:O7******** ******@TK2MSFTN GP02.phx.gbl...
>tell me the steps (the answer)
Thank you
"rowe_newsgrou ps" <ro********@yah oo.comwrote in message
news:00******* *************** ************@34 g2000hsf.google groups.com...
On Jul 26, 4:50 am, "a" <a...@a.netwrot e:
>>Dear friends

I want import data from CSV file to mdb file How can I do that in
vb.net?

ADO.NET

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/

Jul 28 '08 #7
a,

It is important that you tell us if you want to use an import in an existing
database or a new database table.

As you are an expert in Access, you would no the reason.

That there is nothing simple is probably because that Jet is a little bit
out of the focus and everything is now SQL Server, where is a simple
BulkCopy (Although I see that this will be replaced)

For OleDB you have in fact simple to get a DataSet using the connection and
the Fill from CSV and then use that DataSet by looping through the resulted
datatable and then update your database that you have filled first.

For the update you can simple use the commandbuilder.

Cor

"a" <a@a.netschre ef in bericht
news:ed******** ******@TK2MSFTN GP03.phx.gbl...
Dear friends

I want import data from CSV file to mdb file How can I do that in vb.net?


Jul 28 '08 #8
no = know

Sorry

Cor
"Cor Ligthert [MVP]" <no************ @planet.nlschre ef in bericht
news:On******** ******@TK2MSFTN GP02.phx.gbl...
a,

It is important that you tell us if you want to use an import in an
existing database or a new database table.

As you are an expert in Access, you would no the reason.

That there is nothing simple is probably because that Jet is a little bit
out of the focus and everything is now SQL Server, where is a simple
BulkCopy (Although I see that this will be replaced)

For OleDB you have in fact simple to get a DataSet using the connection
and the Fill from CSV and then use that DataSet by looping through the
resulted datatable and then update your database that you have filled
first.

For the update you can simple use the commandbuilder.

Cor

"a" <a@a.netschre ef in bericht
news:ed******** ******@TK2MSFTN GP03.phx.gbl...
>Dear friends

I want import data from CSV file to mdb file How can I do that in vb.net?


Jul 28 '08 #9
Your best course of action is to research the task at hand using Google. My
approach would be to discover how to read the CSV file into a collection
which can be looped though for data correctness then when this is done use
OleDb components to store the data.

The best advice after searching and reading MSDN documentation is to ask
your question here supplement your question with snippets of code so the
experts here can assist you.

Why not break down the objective as follows; read a text file line by line
i.e. System.IO.Strea mReader, Loop thru this data, parse the data perhaps
using Regular expressions followed by validating and pushing the data to the
Access database using OleDb components.

Good luck :-)

"a" <a@a.netwrote in message news:u6******** ******@TK2MSFTN GP04.phx.gbl...
Dear friends

I'm not strong vb.net programmer I'm just take course and I want to learn
from you

And I have Excellent knowledge of access 2003 (Expert)

In access 2003 to import data from CSV file you just select file import
and select text

And all CSV file will import in a new table with some steps with the
wizard

know I want just import data from CSV file to Access using VB.NET

by button in vb.net form just click this button the vb.net imports data
from csv file to access mdb file

Mr. Paul

Microsoft MVP (Visual Basic)

give me this code :

Dim AccessConn As New
System.Data.Ole Db.OleDbConnect ion("Provider=M icrosoft.Jet.OL EDB.4.0;"
& _
"Data Source=C:\Test Files\db1 XP.mdb")

AccessConn.Open ()

'New table
Dim AccessCommand As New System.Data.Ole Db.OleDbCommand ("SELECT *
INTO [TextFileTable] FROM
[Text;DATABASE=C :\Documents and Settings\...\My Documents\My
Database\Text].[Textfile.txt]",
AccessConn)
'Existing table
'Dim AccessCommand As New System.Data.Ole Db.OleDbCommand ("INSERT
INTO [TextFileTable] (F1,
F2, F3, F4, F5) SELECT F1, F2, F3, F4, F5 FROM
[Text;DATABASE=C :\Documents and Settings\...\My
Documents\My Database\Text].[Textfile.txt]", AccessConn)

AccessCommand.E xecuteNonQuery( )
AccessConn.Clos e()

But there is error in the code I can't benefit form this code

The error in sql code

I'm edit this code like this but also there is error in sql code:

Dim cn As New OleDbConnection

cn.ConnectionSt ring = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=test.mdb ;Persist Security Info=False"

cn.Open()

Dim cmd As New OleDbCommand

cmd.CommandText = ("SELECT * INTO [TextFileTable] FROM [Text;DATABASE=
E:\a.csv]")

cmd.Connection = cn
cmd.ExecuteNonQ uery()

cn.Close()

==

Can you edit the code for me







"Gillard" <gillard_george s@@@@@@@@@hotma il.comwrote in message
news:OM******** ******@TK2MSFTN GP02.phx.gbl...
>by just having a look at the code project web site and searching CSV you
can find what you are looking for
"a" <a@a.netwrote in message
news:O7******* *******@TK2MSFT NGP02.phx.gbl.. .
>>tell me the steps (the answer)
Thank you
"rowe_newsgro ups" <ro********@yah oo.comwrote in message
news:00****** *************** *************@3 4g2000hsf.googl egroups.com...
On Jul 26, 4:50 am, "a" <a...@a.netwrot e:
Dear friends

I want import data from CSV file to mdb file How can I do that in
vb.net?

ADO.NET

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/


Jul 28 '08 #10

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

Similar topics

2
3089
by: David Berry | last post by:
Hi All. I'm looking for any help or sample code that can show me how to make a file import wizard in ASP.NET (VB preferred) like the one that MS Access uses. I'm working on a web site where the user has the ability to upload a file (.txt or .csv). The data in the file may be comma delaminated, tab delaminated, fixed width etc (we don't know). What I'd like to create is something like MS Access uses to import an Excel file into the...
3
4182
by: Anthony Robinson | last post by:
I have an issue I've been working on that has proven to be quite troublesome. I already have an idea of what the anwser may be, but would like to solicit some suggestions or other ideas from you guys (and gals I'm sure). We have an application that will store BLOB data (jpegs) along with character data. The data comes to us in an xml format.; and this xml document contains both the character and the blob/binary data. Here is the table...
1
9758
by: DCM Fan | last post by:
Access 2K, SP3 on Windows 2K, SP4 All, I have an import spec set up with quoted Identifiers and comma-separated values. The text file is produced by a 3rd-party program of which I have no control. It outputs all text fields surrounded by quotes, and all numeric fields w/o quotes. All fields are separated with commas. This has been working for 2 years, until today, when one of the data fields
1
6709
by: Dan | last post by:
Could someone please help me with auto importing a series of data files into an Access table. I tried to follow code given below in a previous messagebut i'm getting error messages. Here's my database stats: Path: C:\Database (contains the database and all the text files to be imported) Text files to import: (SampleData4.txt and SampleData3.txt as testing examples)
3
3726
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook - and dump everything into a table. The problem is once I have the data imported into a new table, I can't do much with it. If I try to run an Append query and insert data from the new table into an existing table, the query fails - "Error...
4
6115
by: Bruce W. Roeser | last post by:
All, I'm reading a book by Charles Petzold (Programming VS.Net). Pretty good content but am confused about the difference. From the text: ---------------------------------------------------------------------------------------------------------------------------------------------------------- The @ Import Directive Next to @ Page, the directive that ASP.NET programmers use the most is @ Import. The @ Import directive is ASP.NET's...
3
2310
by: Chris | last post by:
Hi, 1) In file test.aspx, i put: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %> <%@ import namespace="System.Data"%> <%@ import namespace="System.Data.OleDb"%> .... In file test.aspx.vb, i put:
10
1616
by: nisp | last post by:
Hi all ! I'm trying to capture stderr of an external module I use in my python program. I'm doing this by setting up a class in my module overwriting the stderr file object method write. The external module outputs to stderr this way: from sys import std err
6
26342
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this one table. My problem is I have two buttons I want to use this code for for the two buttons would put the data in different tables. I have tried copying and changing a few things and nothing will work for me. The code is set up in a module and then I...
0
9766
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11065
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
10700
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
9536
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...
1
7934
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
7098
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
5763
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...
0
5962
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4583
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

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.