Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > Visual Web Developer 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Display Modes
  #1 (permalink)  
Old August 29th, 2007, 05:16 PM
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(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



Reply With Quote
  #2 (permalink)  
Old April 12th, 2008, 04:06 AM
Registered User
 
Join Date: Apr 2008
Location: , , .
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
Reply With Quote
Reply


Thread Tools
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
MS Access With VB.NET N4T3.T4NN3R ADO.NET 0 October 9th, 2008 02:47 PM
Import text file to MS Access, ASP.net rykie Access ASP 0 August 31st, 2007 04:07 AM
Administer MS Access MDW file in VB.NET iii_carlos BOOK: Beginning VB.NET Databases 1 April 30th, 2007 07:25 AM
Multiple delimiter Text file import into Access Suomi Access VBA 2 June 12th, 2005 11:26 AM



All times are GMT -4. The time now is 12:18 PM.


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