OLE JET and Booleans

Discussion in 'ASP General' started by Dr. Know, Jan 6, 2005.

  1. Dr. Know

    Dr. Know Guest

    I seem to be having an unresolvable problem with an ASP page (darned
    typeless scripting engines) and JET datatypes. Don't ask why we are
    using JET, let's just say it has something to do with LEGACY CRAP used
    by hundreds of dealers scattered over the US.

    The MDB has two boolean fields and when trying to add new records with
    the INSERT INTO execute method, it dies.

    All works well with strings, but not with booleans.

    Booleans are retrieved from the WebPage with ASP using:

    strTaxable=request.form("Taxable")
    These values can be 0 and 1.

    Then we use :

    set objparam=cm.createparameter(, adBoolean, , , cbool(strTaxable))
    cm.parameters.append objparam

    Crashes every time - no error number, just a vague error message that
    there is a syntax error in the JET INSERT INTO statement...

    However, the same code more or less works using the ODBDC drivers -
    which we are trying to avoid.

    Any ideas?


    Dr. Know
     
    Dr. Know, Jan 6, 2005
    #1
    1. Advertising

  2. Dr. Know

    Lance Wynn Guest

    Just a guess, but instead of using cbool(strTaxTable) try cInt(strTaxTable).


    "Dr. Know" <> wrote in message
    news:...

    I seem to be having an unresolvable problem with an ASP page (darned
    typeless scripting engines) and JET datatypes. Don't ask why we are
    using JET, let's just say it has something to do with LEGACY CRAP used
    by hundreds of dealers scattered over the US.

    The MDB has two boolean fields and when trying to add new records with
    the INSERT INTO execute method, it dies.

    All works well with strings, but not with booleans.

    Booleans are retrieved from the WebPage with ASP using:

    strTaxable=request.form("Taxable")
    These values can be 0 and 1.

    Then we use :

    set objparam=cm.createparameter(, adBoolean, , , cbool(strTaxable))
    cm.parameters.append objparam

    Crashes every time - no error number, just a vague error message that
    there is a syntax error in the JET INSERT INTO statement...

    However, the same code more or less works using the ODBDC drivers -
    which we are trying to avoid.

    Any ideas?


    Dr. Know
     
    Lance Wynn, Jan 6, 2005
    #2
    1. Advertising

  3. Dr. Know

    Morris Guest

    Dr. Know wrote:
    > I seem to be having an unresolvable problem with an ASP page (darned
    > typeless scripting engines) and JET datatypes. Don't ask why we are
    > using JET, let's just say it has something to do with LEGACY CRAP used
    > by hundreds of dealers scattered over the US.
    >
    > The MDB has two boolean fields and when trying to add new records with
    > the INSERT INTO execute method, it dies.
    >
    > All works well with strings, but not with booleans.
    >
    > Booleans are retrieved from the WebPage with ASP using:
    >
    > strTaxable=request.form("Taxable")
    > These values can be 0 and 1.
    >
    > Then we use :
    >
    > set objparam=cm.createparameter(, adBoolean, , , cbool(strTaxable))
    > cm.parameters.append objparam
    >
    > Crashes every time - no error number, just a vague error message that
    > there is a syntax error in the JET INSERT INTO statement...
    >
    > However, the same code more or less works using the ODBDC drivers -
    > which we are trying to avoid.
    >
    > Any ideas?
    >
    >
    > Dr. Know



    The values for the Yes/No field in Access are either 0 or -1. Is
    Request.Form("taxable") a checkbox? If it is, then no value will be
    passed if it is unchecked.

    Morris
     
    Morris, Jan 6, 2005
    #3
  4. Dr. Know wrote:
    > I seem to be having an unresolvable problem with an ASP page (darned
    > typeless scripting engines) and JET datatypes. Don't ask why we are
    > using JET, let's just say it has something to do with LEGACY CRAP used
    > by hundreds of dealers scattered over the US.
    >
    > The MDB has two boolean fields and when trying to add new records with
    > the INSERT INTO execute method, it dies.
    >
    > All works well with strings, but not with booleans.
    >
    > Booleans are retrieved from the WebPage with ASP using:
    >
    > strTaxable=request.form("Taxable")
    > These values can be 0 and 1.
    >
    > Then we use :
    >
    > set objparam=cm.createparameter(, adBoolean, , , cbool(strTaxable))
    > cm.parameters.append objparam


    There is no reason to use a Command object unless you are executing a
    parameterized dynamic sql statement. Could we see a little more code please?
    just the code used to populate and run the Command parameters and settings -
    we don't need to see any html.

    >
    > Crashes every time - no error number, just a vague error message that
    > there is a syntax error in the JET INSERT INTO statement...
    >
    > However, the same code more or less works using the ODBDC drivers -
    > which we are trying to avoid.
    >


    This sounds like an issue with a reserved keyword. Are you executing a
    parameterized dynamic sql statement? Or a saved parameter query?

    Check your field names against the list of reserved keywords found here:
    http://www.aspfaq.com/show.asp?id=2080




    --
    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], Jan 6, 2005
    #4
  5. Dr. Know

    Dr. Know Guest

    Bob Barrows [MVP] said:

    >This sounds like an issue with a reserved keyword. Are you executing a
    >parameterized dynamic sql statement? Or a saved parameter query?
    >
    >Check your field names against the list of reserved keywords found here:
    >http://www.aspfaq.com/show.asp?id=2080


    You were right on the money!

    I discovered the problem some time after I posted the original plea
    for help. Removed fields one at a time until the bad one popped up.
    What a pain...

    Discovered the field name [Password] in the original table - which
    cannot be re-designed.

    The list you supplied the link to has taken up permanent residence in
    my ever growing collection of bizarre errata.

    This stuff is support work for an antiquated X-base accounting system
    which still has no GUI, and uses Telnet for communication with the
    outside world. The tables cannot be changed or redesigned.

    Personally, I'd rather see them using a comprehensive SQL solution...
    They've already added 3rd party online ordering systems, reporting
    systems, etc. It's One Big Kludge. cha-ching...

    Now if I could just get Provider=vfpoledb;Data Source=C:\xxx\xxxx\"
    to work in ASP. Works in Access and VB, but not ASP. :-|

    Thanks,
    Greg



    Dr. Know
     
    Dr. Know, Jan 7, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick.O.Ige

    Ole ole

    Patrick.O.Ige, Jul 16, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    523
    Patrick.O.Ige
    Jul 16, 2006
  2. Roman Suzi

    Booleans and comparison results

    Roman Suzi, Jun 24, 2003, in forum: Python
    Replies:
    0
    Views:
    721
    Roman Suzi
    Jun 24, 2003
  3. =?ISO-8859-1?Q?Gerhard_H=E4ring?=

    Re: Booleans and comparison results

    =?ISO-8859-1?Q?Gerhard_H=E4ring?=, Jun 24, 2003, in forum: Python
    Replies:
    0
    Views:
    713
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=
    Jun 24, 2003
  4. Drew Pihera
    Replies:
    0
    Views:
    665
    Drew Pihera
    Feb 4, 2004
  5. Lance Hoffmeyer
    Replies:
    0
    Views:
    273
    Lance Hoffmeyer
    Nov 17, 2003
Loading...

Share This Page