Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 May 15th, 2006, 07:12 AM
Authorized User
 
Join Date: Dec 2005
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default Importing data from CSV file

Hai,
    How can i import data from CSV file and fill it in the data base or data adaptor. Thanks in advance.

                       Vamsi

vamsi
__________________
vamsi Krishna G
mobile: 91 + 9986023966.
124 Puttappa layout new Tippasandhra,
bangalore.
Inida
 
Old May 15th, 2006, 11:23 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I don't belive there is a way, I know there is using XML. You would have to use DTS if you are using SQL Server.

 
Old May 23rd, 2006, 01:29 AM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to vsnsudha
Default

Hi

i think it is late for u. but even, there is a solution for ur question. ofcourse i think it may help u.

Dim ds As New DataSet
' Pull connection string from Web.Config (will be encrypted later)
Dim objConn As New System.Data.OleDb.OleDbConnection( _
System.Configuration.ConfigurationManager.Connecti onStrings _
                                        ("MyConnectionString").ToString)

'WHY DOES THIS SITE CHOP APART "ConnectionStrings" ABOVE???
' THERE SHOULD NOT BE A SPACE THERE!! I PUT NONE THERE!

' Make sure the .CSV file exists:
If File.Exists(strPath & strFileName) Then
            Try
                ' ------ Load the data from the .CSV file: ----------
                ' NOTE: "Source' is text user enters that gets put into db
                ' Grab "Source" text from ASP.NET textbox:
                Dim strSource As String = Me.txtSource.Text

                Dim strSQL As String = "INSERT INTO [tblDoNotCallList] " & _
                "(AreaCode, PhoneNumber,Source, DateTimeAdded)" & _
                "SELECT F1, F2,'" & strSource & "', Now() AS DateTimeStamp" & _
                " FROM [Text;HDR=NO;DATABASE=C:\Documents and" & _
               "Settings\...\Website;].[importFile.csv]"

                objConn.Open()
                Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL, objConn)
                objCommand.CommandText = strSQL
                objCommand.ExecuteNonQuery()
                objConn.Close()
             Catch ex as Exception
                'handle error here
             End Try

and another one is in vb i am giving u the link

http://www.vb-helper.com/howto_ado_load_csv.html






Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing data from a CSV file? kr33 SQL Server 2000 26 January 3rd, 2007 02:38 AM
Importing CSV file into SQL from Web daniel SQL Server 2005 6 December 15th, 2006 09:48 AM
Importing a CSV file into SQL rsmuts ASP.NET 1.0 and 1.1 Professional 2 July 24th, 2006 10:14 AM
Importing data from .csv Spitzbucket PHP Databases 0 February 20th, 2005 01:42 PM





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