Import from Excel into database using jet in VB.net

A

Andy HP

I can import data from Excel to a non protected access database using the
code below.
How can I amend the code to import the data into the password protected
database myDatabase ?

Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
source=myExcelFile;Extended Properties='Excel 8.0;HDR=YES;'"
Comm.CommandType = CommandType.Text
Comm.CommandText = "SELECT * INTO tblNEW IN 'myDatabase' FROM [Sheet1$]'
Comm.Connection = Conn
Conn.Open()
Comm.ExecuteNonQuery()
Conn.Close
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top