Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Re: CSV to Access

    CJA wrote:
    > Hi
    >
    > I have a very simple script that seems to work OK inserting into an
    > Access table from a CSV file. The problem I have is that the first
    > column (stored as text) has student ID numbers - some start with
    > 100... others start with a character like K or M. It inserts the
    > 100... IDs but not the rest. Anyone any ideas?
    What are the symptoms? Do you get any error messages? Could it be attempting
    to insert text into a numeric field?
    > Here is the code:
    >
    > set objConn= Server.CreateObject("ADODB.Connection")
    >
    > strDBPath = Server.MapPath("../DB/Live.mdb")
    > objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > strDBPath & ";"
    >
    > Dim csv_path
    > csv_path = Server.MapPath("./Uploads") & "\"
    >
    >
    Why do you assign this text to the SQL variable:
    > SQL = "SELECT * INTO Learner FROM [Learner2.csv] IN """ &
    > csv_path & """ ""TEXT;"""
    >
    and immediately overwrite it with this text?
    > SQL = "INSERT INTO Learner SELECT * FROM [Learner2.csv] IN """ &
    > csv_path & """ ""TEXT;"""
    >
    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows [MVP] Guest

  2. Similar Questions and Discussions

    1. Web Service + Anon Access, but getting 401 Access Denied Error
      I have a simple webservice that just returns a string. The security for this is set to windows authentication in IIS (XP Professional) and anonymous...
    2. Network File access using anonymous access
      I have seen a number of entries related to accessing remote resources (files in my case) that need to reside on a remote server. We must leave our...
    3. Access 2002 PDFWriter VBA Code w/WinXP does not work like Access 2000
      I am trying to print an Access 2002 report (Windows XP OS) as a PDF. I had success with Access 2000 in a Windows 2000 environment, but as soon as I...
    4. Access Violation when using Visual Interdev to access Oracle
      I am running Windows 200 Pro, IIS 5.0 and trying to connect to an Oracle 8.1 database. Prior to applying a security patch to W2k, the ASP...
    5. Access denied when creating Access application object
      In an ASP file I am running the following in VBScript in order to extract data from an Access 2002 MDB file which is physically located in the...
  3. #2

    Default CSV to Access

    Hi

    I have a very simple script that seems to work OK inserting into an
    Access table from a CSV file. The problem I have is that the first
    column (stored as text) has student ID numbers - some start with 100...
    others start with a character like K or M. It inserts the 100... IDs but
    not the rest. Anyone any ideas? Here is the code:

    set objConn= Server.CreateObject("ADODB.Connection")

    strDBPath = Server.MapPath("../DB/Live.mdb")
    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath
    & ";"

    Dim csv_path
    csv_path = Server.MapPath("./Uploads") & "\"


    SQL = "SELECT * INTO Learner FROM [Learner2.csv] IN """ & csv_path &
    """ ""TEXT;"""

    SQL = "INSERT INTO Learner SELECT * FROM [Learner2.csv] IN """ &
    csv_path & """ ""TEXT;"""

    'Executing the SQL Statement
    ObjConn.Execute SQL

    Hope someone has the answer.

    CJA


    CJA Guest

  4. #3

    Default Re: CSV to Access


    Hi Sorry about the cross-post. I am new to this.

    I don't get any error messages. It just leaves the field blank if it comes
    across an ID with a character at the begining. This is simply a bit of
    script I found elsewhere. It works fine on other files. The field it
    inserts into is text, so it should be OK.

    CJA
    CJA Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139