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

How to Import and Export Ms Access data using vb.net 2008

Hi guys,

I need a help. I have EmployeesInfo system with several tables (Employees, Payroll and Purchases tables) in Ms Access Database and forms in Vb.Net accordingly.

How can I Export and Import data from Ms Access Database using vb.net 2008 ?. Can anyone help me with codes ?. I had coded but does not work !.

Expand|Select|Wrap|Line Numbers
  1. Private Sub ExportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExportToolStripMenuItem.Click
  2.         Dim source, target As String
  3.         source = Application.CommonAppDataPath & "\EmployeesInfo.mdb" 'this is the path where vb stores databse file. 
  4.         If SaveFileDialog1.ShowDialog() <> Windows.Forms.DialogResult.Cancel Then 'sfdFile is save file dialogue 
  5.             target = SaveFileDialog1.FileName
  6.             Try
  7.                 My.Computer.FileSystem.CopyFile(source, target, True)
  8.                 MsgBox("Export Completed Successfully")
  9.             Catch ex As Exception
  10.                 MsgBox(ex.Message)
  11.             End Try
  12.         End If
  13.     End Sub
  14.  
  15.  
  16. Private Sub ImportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImportToolStripMenuItem.Click
  17.         Dim source, target As String
  18.         If OpenFileDialog1.ShowDialog() <> Windows.Forms.DialogResult.Cancel Then ' ofdFile is open file dialouge 
  19.             source = OpenFileDialog1.FileName
  20.             target = Application.CommonAppDataPath & "\EmployeesInfo.mdb"
  21.             Try
  22.                 My.Computer.FileSystem.CopyFile(source, target, True)
  23.                 MsgBox("Import Completed Successfully")
  24.             Catch ex As Exception
  25.                 MsgBox(ex.Message)
  26.             End Try
  27.  
  28.         End If
  29.  
  30.     End Sub
Oct 31 '13 #1
0 2007

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

Similar topics

2
by: Colin Graham | last post by:
I have a little problem i was wondering if anyone could help. I have created a table in Access and it has the following format. UniqueID FieldResult 100 1,3,5,7,23,7,8,9,12,4 103 ...
1
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this...
3
by: Aliza Klein | last post by:
I have a client who wants to export his Access purchase order data (from the system I am designing) directly into Quickbooks. I know I can create a CSV or similar that Quickbooks can then import -...
4
by: xwings | last post by:
I want to export my data to "Notepad" Or "Excel" Below is my Access Database Data; http://img340.imageshack.us/img340/3842/pictureju0.jpg How can i done that with VB6? or isit possible that i...
2
by: Magnus Warker | last post by:
Hi, my app has an export functionality which writes all data from the db into a xml-file. It also has an import functionality for the opposite direction. The size of the current xml-file is...
4
by: jonjon sanchez | last post by:
Hi I'm Jon I want to asked a help about vb6.0 access data on microsoft access database. I going to used log in form using vb, I want save several username and password in my database that...
10
by: milas57 | last post by:
hello everyone how can i import Ms Access data into MySql thank you
0
by: shwethatj | last post by:
Can anyone please help me..... In Crystal Reports , how to access data using PULL method .. I have got a table in server explorer which has 3 got fields. But i dont know how to access it and...
2
by: dileshw | last post by:
hey guys, I have a access (2000 format) database. I want to be able to export all the tables in it onto a single .xls file and import it from an identical .xls file (for example if i email the...
2
by: Susan Littlefie | last post by:
I want to know an easy way to export Access data to Quickbooks.
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
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...
0
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...

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.