Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to write back to Access-2000 Yes/No fields

Reply
Thread Tools

How to write back to Access-2000 Yes/No fields

 
 
Les Juby
Guest
Posts: n/a
 
      06-11-2005
Getting really stumped here.....

Using Classic.ASP and after an editing page has been completed I need
to write the values back to an Access 2000 database. But I'm battling
with a checkbox resultwhich has to be stored in aYes/No field.

I'm testing the variable no_mail to see if it returns "on" in ASP
which means the checkbox is ticked. I then load a variable called
sql_val_no_mail with the text that the SCP statement will use to
update into Access.

ie.
If no_mail = "on" Then
sql_val_no_mail = "Yes"

and then.....
" no_e-mail='" & sql_val_no_mail & "',"
goes into the SQL string

But what do you feed into Access for the Yes/No field to record a
positive

Tried: Yes "Yes" True "True" 1 "1" 0 "0" on

Any suggestions, please.....

thanks

.les.





 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-11-2005
Les Juby wrote:
> Getting really stumped here.....
>
> Using Classic.ASP and after an editing page has been completed I need
> to write the values back to an Access 2000 database. But I'm battling
> with a checkbox resultwhich has to be stored in aYes/No field.
>
> I'm testing the variable no_mail to see if it returns "on" in ASP
> which means the checkbox is ticked. I then load a variable called
> sql_val_no_mail with the text that the SCP statement will use to
> update into Access.
>
> ie.
> If no_mail = "on" Then
> sql_val_no_mail = "Yes"
>
> and then.....
> " no_e-mail='" & sql_val_no_mail & "',"
> goes into the SQL string
>
> But what do you feed into Access for the Yes/No field to record a
> positive
>
> Tried: Yes "Yes" True "True" 1 "1" 0 "0" on
>


-1 = true/yes/on
0 = false/no/off

Write the numeric value to the database field
--
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"


 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-11-2005
Les Juby wrote:
> Getting really stumped here.....
>
> Using Classic.ASP and after an editing page has been completed I need
> to write the values back to an Access 2000 database. But I'm battling
> with a checkbox resultwhich has to be stored in aYes/No field.
>
> I'm testing the variable no_mail to see if it returns "on" in ASP
> which means the checkbox is ticked. I then load a variable called
> sql_val_no_mail with the text that the SCP statement will use to
> update into Access.
>
> ie.
> If no_mail = "on" Then
> sql_val_no_mail = "Yes"
>
> and then.....
> " no_e-mail='" & sql_val_no_mail & "',"
> goes into the SQL string
>
> But what do you feed into Access for the Yes/No field to record a
> positive
>
> Tried: Yes "Yes" True "True" 1 "1" 0 "0" on
>
> Any suggestions, please.....
>
> thanks
>
> .les.


And stop using dynamic sql. use saved parameter queries (my preference):
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

or

ODBC placeholders (?) with an explicit Command object to pass the values to
the placeholders:
http://groups-beta.google.com/group/...e36562fee7804e

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"


 
Reply With Quote
 
Les Juby
Guest
Posts: n/a
 
      06-12-2005
Oi, thanks for that help.!

I really do take your point about the horrors of dynamic SQL but this
site in particular is full of legacy code so we will have to keep it
in place. But I'm looking hard at switching to the parameter queries.

Main reason for my reply, especially if it can help someone else, is
that the real problem here was that I was using an illegal construct
in the field name. ie.
>> " no_e-mail='" & sql_val_no_mail & "',"


Once I changed the fieldname from no_e-mail to no_email then the 0 and
-1 was accepted fine.! This particular code is a construction of
backend code to replace manual maintenance of Access databases so the
problem never occurred when an Access Form was being used to update
details. We live and we learn......

Can't even begin to recount how many times I have hit major problems
because of reserved names for fields. Now I need to remember that a
hyphen should probably be always avoided in Access 2000 field names,
especially numeric field names.!

thanks again

.les.



On Sat, 11 Jun 2005 13:49:06 -0400, "Bob Barrows [MVP]"
<(E-Mail Removed)> wrote:

>Les Juby wrote:
>> Getting really stumped here.....
>>
>> Using Classic.ASP and after an editing page has been completed I need
>> to write the values back to an Access 2000 database. But I'm battling
>> with a checkbox resultwhich has to be stored in aYes/No field.
>>
>> I'm testing the variable no_mail to see if it returns "on" in ASP
>> which means the checkbox is ticked. I then load a variable called
>> sql_val_no_mail with the text that the SCP statement will use to
>> update into Access.
>>
>> ie.
>> If no_mail = "on" Then
>> sql_val_no_mail = "Yes"
>>
>> and then.....
>> " no_e-mail='" & sql_val_no_mail & "',"
>> goes into the SQL string
>>
>> But what do you feed into Access for the Yes/No field to record a
>> positive
>>
>> Tried: Yes "Yes" True "True" 1 "1" 0 "0" on
>>
>> Any suggestions, please.....
>>
>> thanks
>>
>> .les.

>
>And stop using dynamic sql. use saved parameter queries (my preference):
>http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl
>
>or
>
>ODBC placeholders (?) with an explicit Command object to pass the values to
>the placeholders:
>http://groups-beta.google.com/group/...e36562fee7804e
>
>Bob Barrows


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
epydoc: How to add new fields as the building fields? Cyril.Liu Python 0 12-02-2008 05:01 AM
print struct fields and its member structs' fields recursively, generically call_me_anything C++ 4 09-30-2007 10:12 PM
how to copy from fields to other fields middletree ASP General 1 11-05-2003 06:24 PM
Netscape hidden fields - array - multiple fields with same name mark.reichman@rl.af.mil Javascript 0 07-17-2003 03:05 PM



Advertisments