ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Import from Excel into database using jet in VB.net (https://www.excelbanter.com/excel-discussion-misc-queries/175877-import-excel-into-database-using-jet-vbulletin-net.html)

Andy HP

Import from Excel into database using jet in VB.net
 
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


All times are GMT +1. The time now is 04:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com