Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access ASP
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 31st, 2007, 03:07 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Import text file to MS Access, ASP.net

Hi
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")
        cnn.Open()


        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
        objCommand.ExecuteNonQuery()
        cnn.Close()

    Thx


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:03 AM.


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