Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access ASP
Access ASP Using ASP with Microsoft Access databases. For Access questions not specific to ASP, please use the Access forum. For more ASP forums, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 31st, 2007, 03:07 AM
Registered User
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Import text file to MS Access, ASP.net

I would appreciate any assistance with the above.
I am use to VBA in Access which is a 1 line code - docmd.tranfertext... to import information into an access database.

I am working with VB in ASP.net. I am new to this environment.
I already have a table tblcurrency. I want to update my table with text file C:\Textfile.txt
I will change the paths later - just want the code to work first

The error is:
Syntax error in INSERT INTO statement.
Microsoft JET Database Engine

My code is:
 Dim cnn As OleDbConnection
        Dim strSQL As String
        Dim Debug As Diagnostics.Debug

        cnn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = c:\Inetpub\wwwroot\TestDB\DB\Bonus.mdb")

        strSQL = "INSERT INTO [TblCurrency] (Country, Year) SELECT F1, F2 FROM[Text;HDR=NO;DATABASE=C:\;].[test.txt]"

       Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL, cnn)
        objCommand.CommandText = strSQL


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET with MS Access help ayazhoda ASP.NET 2.0 Professional 1 April 5th, 2007 08:13 AM
Multiple delimiter Text file import into Access Suomi Access VBA 2 June 12th, 2005 10:26 AM
Import a report from MS Access Ilya Crystal Reports 0 March 1st, 2005 05:08 AM
ASP Error with Ms Access file sloynaz Access 1 May 15th, 2004 04:33 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.