Excel into Access using ASP with DWMX

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Excel into Access using ASP with DWMX

    Hi
    Anyone know an ASP script for transferring data from an Excel sheet to an
    Access table, some of the fields of which contain names which have an
    apostrophe (') in them.
    I have tried all sorts of things but am getting tripped up by the apostrophe
    which is used as a field container in the SQL :

    "INSERT INTO tblResults Values(0,'" & rsExcel("FeisID") & "' , '" &
    rsExcel("CompNo") & "' , '" & rsExcel("Entry") & "' , '" & rsExcel("Name") &
    "' , '" & rsExcel("School") & "' , '" & rsExcel("Position") & "' , '0' , '"
    & Done & "')"

    The first field is the ID field of tblResults and need to be incremented
    automatically. If I leave the first value out, I get an error along the
    lines of "Number of query values and destination fields are not the same"
    Also, if the name field is like Harry O'Hare, the thing fails...
    Any ideas anyone? Many thanks

    Jim



    Jim Guest

  2. Similar Questions and Discussions

    1. Excel to an Access DB
      I have an office that would like to have an Excel Spreadsheet with a training roster put onto our website with the ability to Insert/Update/Delete. ...
    2. Name Redefined? What is this Dim? (DWMX/ASP/VBscript/Access)
      Hi, I've been having this problem with a few sites now. It appears that in some cases, and I can't spot a trend, but when I add a recordset to a...
    3. Export from Excel to Access using ASP in DWMX
      Hi Anyone know an ASP script for transferring data from an Excel sheet to an Access table, some of the fields of which contain names which have an...
    4. ASP Access 2 Excel
      Hello All, I've got a small'ish Access 2000 database which I'd like to be able to convert to Excel then email to the owner. I was hoping to use...
    5. DWMX V6.0 and DWMX V7.0 Lost Feature - TIMELINE
      DWMX V6.0 and DWMX V7.0 Lost Feature - TIMELINE Has anyone noticed the "MODIFY timeline" feature in DWMX Version 6.0 is gone in DWMX V7.0. The...
  3. #2

    Default Re: Excel into Access using ASP with DWMX

    Hi Jim, You'll need to do a replace on the fields to get rid of the single
    quotes. The best way is to first build yourself a function, like so: <%
    function cleanString(myStr) cleanString = Replace(myStr, ''', '''') end
    function %> Then, wrap that around each of your values: INSERT INTO
    tblResults VALUES (0, '' &amp; cleanString(rsExcel('FeisID') &amp; '', ...
    That will allow you to insert apostrophes into the database by escaping them
    with double apostrophes. Hope that helps.

    webshorts 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