update statement with DSN works, DSN-less fails

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

  1. #1

    Default update statement with DSN works, DSN-less fails

    the following SQL statement works when executing via a DSN connection
    but fails when using the DSN-less method.


    sql statement:

    UPDATE tblApplicants SET ApplicantName='116th Pennylvania Volunteer
    Infantry', ContactName='John Smith', Address='1234 S. Main St. #23',
    City='Cityville ', State='CA', Zip='12345-',
    DaytimePhone='(555)555-5555', PhoneExt='',
    EveningPhone='(555)555-5555', Email='jsmith@whatever.com',
    PreviousEntry=1, YearsInParade=1, Accepted=1, Insurance=1,
    Commercial=0, Year=2003, EntryScript='blah, blah, blah. more blah',
    NumberInGroup=45, DblPull=1, Wagon=1, PartnerDblPull=0, Horses=0,
    LineUpFootage=0, Description='116th blah text text - blah.blah.blah
    ,blah and blah', Notes='', UnitSizeBanners='', DivisionID=1, Active=1
    where ApplicantID=283;


    asp code:

    var oConn = Server.CreateObject('ADODB.Connection');
    oConn.Mode = 3;
    oConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data
    Source=F:\\myDir\\website\\myDB.mdb";
    oConn.Open();
    oRS = oConn.Execute(sql);
    .....


    error returned:

    Microsoft JET Database Engine error '80040e14'
    Syntax error in UPDATE statement.


    platform:
    win2k, access 2k, ADO 2.6


    i can read from the DB just fine and i can also execute other UPDATE
    SQL statements elsewhere in my application. i have set IUSR_machine
    read/write permissions to the db dir + file, read thru the many posts
    regarding this error and have not found a solution. exactly what is
    the difference between using DSN/DSN-less w/ the provided sql
    statement?!?!?!

    any help would be extremely appreciated!!!

    cheers,
    scott
    scott Guest

  2. Similar Questions and Discussions

    1. Update fails on CF 7.0, works on CF 5.0
      I'm not sure what's going on. The UPDATE below works with CF5.0 with MS Access ODBC, but fails with CF 7.0 with MS Access with Unicode. I first...
    2. IsPlaying() works on one SWF and fails on another?
      On a webpage with a Flash clip I use javascript which checked the value of window.document.movie.IsPlaying() to see if the clip is still palying and...
    3. sql statement works in query analyzer but not in asp/ado?
      I am new to asp/ado (well and sql server)... this has been driving me mad for hours now. I have created an SQL statment using access query design. I...
    4. VPN works on dial-up but fails through LAN
      Running Windows XP Pro on my laptop, when I activate VPN to access my coporate server, it works flawlessly if I dial-up directly from the laptop...
    5. if statement always fails !!!
      "The Script Smiths - PHP/PERL Developers" <mh2@isis.co.za> wrote in message news:<3efaa8fa$0$237@hades.is.co.za>... That was it. Sometimes you...
  3. #2

    Default Re: update statement with DSN works, DSN-less fails

    This type of error usually means you've used a reserved word for one of your
    column or table names. Let's see ... yep, "Year" is a reserved word and
    should be avoided object names. If you can't change the column name, you
    will have to remember to surround it with brackets []:

    " ... [Year] = .... "

    Why does it work with ODBC? I'm not sure - it should be reserved with ODBC
    as well, at least, according to this page:
    [url]http://www.aspfaq.com/show.asp?id=2080[/url]

    BTW, you should not be using the recordset object when running an action
    query that returns no records. In fact, you shold be telling ADO not to
    create a recordset object by using the adExecuteNoRecords constant like
    this:

    oConn.Execute(sql,,129);
    /*I almost didn't notice you were using jscript - I was going to comment on
    the lack of the Set keyword ...*/

    129 is the combination of two constants:
    1 = adCmdText which tells ADO that you are executing a sql statement passed
    as a string
    128 = adExecuteNoRecords
    1 + 128 = 129


    scott wrote:
    > the following SQL statement works when executing via a DSN connection
    > but fails when using the DSN-less method.
    >
    >
    > sql statement:
    > Commercial=0, Year=2003, EntryScript='blah, blah, blah. more blah',

    Bob Barrows Guest

  4. #3

    Default Re: update statement with DSN works, DSN-less fails

    thank you bob!! this did the trick...



    "Bob Barrows" <reb_01501@yahoo.com> wrote in message news:<ubV0RERZDHA.1640@TK2MSFTNGP10.phx.gbl>...
    > This type of error usually means you've used a reserved word for one of your
    > column or table names. Let's see ... yep, "Year" is a reserved word and
    > should be avoided object names. If you can't change the column name, you
    > will have to remember to surround it with brackets []:
    >
    > " ... [Year] = .... "
    >
    > Why does it work with ODBC? I'm not sure - it should be reserved with ODBC
    > as well, at least, according to this page:
    > [url]http://www.aspfaq.com/show.asp?id=2080[/url]
    >
    > BTW, you should not be using the recordset object when running an action
    > query that returns no records. In fact, you shold be telling ADO not to
    > create a recordset object by using the adExecuteNoRecords constant like
    > this:
    >
    > oConn.Execute(sql,,129);
    > /*I almost didn't notice you were using jscript - I was going to comment on
    > the lack of the Set keyword ...*/
    >
    > 129 is the combination of two constants:
    > 1 = adCmdText which tells ADO that you are executing a sql statement passed
    > as a string
    > 128 = adExecuteNoRecords
    > 1 + 128 = 129
    >
    >
    > scott wrote:
    > > the following SQL statement works when executing via a DSN connection
    > > but fails when using the DSN-less method.
    > >
    > >
    > > sql statement:
    > > Commercial=0, Year=2003, EntryScript='blah, blah, blah. more blah',
    scott 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