Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > Visual Web Developer 2005
|
Visual Web Developer 2005 Discuss creating ASP.NET 2.0 sites with Microsoft's Visual Web Developer 2005. If your question is more specific to a piece of code than the Visual tool, see the ASP.NEt 2.0 forums instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2005 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 29th, 2007, 04:16 PM
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(VB)

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.

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



 
Old April 12th, 2008, 03:06 AM
Registered User
 
Join Date: Apr 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you still need to specify your database:

DATABASE=c:\Inetpub\wwwroot\TestDB\DB\Bonus.mdb


Hope this helps,

Jimi J





Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access With VB.NET N4T3.T4NN3R ADO.NET 0 October 9th, 2008 01:47 PM
Import text file to MS Access, ASP.net rykie Access ASP 0 August 31st, 2007 03:07 AM
Administer MS Access MDW file in VB.NET iii_carlos BOOK: Beginning VB.NET Databases 1 April 30th, 2007 06:25 AM
Multiple delimiter Text file import into Access Suomi Access VBA 2 June 12th, 2005 10:26 AM





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