OLE JET and Booleans

D

Dr. Know

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
 
L

Lance Wynn

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



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
 
M

Morris

Dr. Know said:
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
 
B

Bob Barrows [MVP]

Dr. Know said:
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
 
D

Dr. Know

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top