Problem with checkbox in registrationconfirmation page

Problem with checkbox in registrationconfirmation page

am 16.11.2004 23:08:15 von jack

Hi,
I have part of a form as following:

Referee



In the above a checkbox is placed in a form which uses POSt method to write
to database.

The registrationconfirmation.asp page writes to the database after
collecting the information from the form.
The following is part of the code to write to database

rs.addnew
'Set the table column = to my input text box from my form
rs("PeopleNameFirst") = Request.Form("txtFirstName")
rs("PeopleNameLast") = Request.Form("txtLastName")
rs("PeopleState") = Request.Form("txtState")
rs("PeopleDOB") = Request.Form("txtDateofBirth")
rs("PeopleReferee") = Request.Form("chkReferee")
rs("PeopleProfessionalClass") = Request.Fo HREF="register.asp">register.asprm("optClass")
rs("PeopleClubCode") = Request.Form("lstClubs")
rs.update
%>

Now when I check the chkReferee field the record is getting added to the
database. However, when i do not check the chkReferee field then an error
message is coming and record does not get added to the database.
ERROR:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB status
value, if available. No work was done.
/sailors/registrationconfirmation.asp, line 34

Please note the line 34 is the following:
rs("PeopleReferee") = Request.Form("chkReferee")

Thanks for any help in advance.

Re: Problem with checkbox in registrationconfirmation page

am 16.11.2004 23:46:20 von unknown

First, please stop with the recordset.addnew stuff. That is not the correct
way to add a new record. Second, please stop using an ODBC connection. For
one thing, if you were using an OLE DB connection, you'd most likely get a
more informative error.

If the checkbox is not checked, Request.Form("chkReferee") will not contain
any data. So, you need to handle that. I don't see anywhere that you
indicated what kind of database you're using or what datatype PeopleReferee
is, so I'll assume SQL Server and bit.

If you CInt your data, if it's empty, it will become zero.

iPeopleReferee = CInt(Request.Form("chkReferee"))

Please see here for the proper way of inserting data:
http://www.aspfaq.com/show.asp?id=2191

Ray at work



"Jack" wrote in message
news:EC160077-D091-49C9-BCD4-7A4A3DC1AE20@microsoft.com...
> Hi,
> I have part of a form as following:
>
> Referee
>
>
>
> In the above a checkbox is placed in a form which uses POSt method to
> write
> to database.
>
> The registrationconfirmation.asp page writes to the database after
> collecting the information from the form.
> The following is part of the code to write to database
>
> rs.addnew
> 'Set the table column = to my input text box from my form
> rs("PeopleNameFirst") = Request.Form("txtFirstName")
> rs("PeopleNameLast") = Request.Form("txtLastName")
> rs("PeopleState") = Request.Form("txtState")
> rs("PeopleDOB") = Request.Form("txtDateofBirth")
> rs("PeopleReferee") = Request.Form("chkReferee")
> rs("PeopleProfessionalClass") = Request.Fo > HREF="register.asp">register.asprm("optClass")
> rs("PeopleClubCode") = Request.Form("lstClubs")
> rs.update
> %>
>
> Now when I check the chkReferee field the record is getting added to the
> database. However, when i do not check the chkReferee field then an error
> message is coming and record does not get added to the database.
> ERROR:
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
> Multiple-step OLE DB operation generated errors. Check each OLE DB status
> value, if available. No work was done.
> /sailors/registrationconfirmation.asp, line 34
>
> Please note the line 34 is the following:
> rs("PeopleReferee") = Request.Form("chkReferee")
>
> Thanks for any help in advance.
>
>

Re: Problem with checkbox in registrationconfirmation page

am 17.11.2004 00:09:08 von jack

Thanks for your input Ray. The backend is actually an Access database. If I
need to add a record from a form having 30-40 fields to a database, does the
sql statement not become ugly with the insert method as compared to addnew
method? Thanks.
"Ray Costanzo [MVP]" wrote:

> First, please stop with the recordset.addnew stuff. That is not the correct
> way to add a new record. Second, please stop using an ODBC connection. For
> one thing, if you were using an OLE DB connection, you'd most likely get a
> more informative error.
>
> If the checkbox is not checked, Request.Form("chkReferee") will not contain
> any data. So, you need to handle that. I don't see anywhere that you
> indicated what kind of database you're using or what datatype PeopleReferee
> is, so I'll assume SQL Server and bit.
>
> If you CInt your data, if it's empty, it will become zero.
>
> iPeopleReferee = CInt(Request.Form("chkReferee"))
>
> Please see here for the proper way of inserting data:
> http://www.aspfaq.com/show.asp?id=2191
>
> Ray at work
>
>
>
> "Jack" wrote in message
> news:EC160077-D091-49C9-BCD4-7A4A3DC1AE20@microsoft.com...
> > Hi,
> > I have part of a form as following:
> >
> > Referee
> >
> >
> >
> > In the above a checkbox is placed in a form which uses POSt method to
> > write
> > to database.
> >
> > The registrationconfirmation.asp page writes to the database after
> > collecting the information from the form.
> > The following is part of the code to write to database
> >
> > rs.addnew
> > 'Set the table column = to my input text box from my form
> > rs("PeopleNameFirst") = Request.Form("txtFirstName")
> > rs("PeopleNameLast") = Request.Form("txtLastName")
> > rs("PeopleState") = Request.Form("txtState")
> > rs("PeopleDOB") = Request.Form("txtDateofBirth")
> > rs("PeopleReferee") = Request.Form("chkReferee")
> > rs("PeopleProfessionalClass") = Request.Fo > > HREF="register.asp">register.asprm("optClass")
> > rs("PeopleClubCode") = Request.Form("lstClubs")
> > rs.update
> > %>
> >
> > Now when I check the chkReferee field the record is getting added to the
> > database. However, when i do not check the chkReferee field then an error
> > message is coming and record does not get added to the database.
> > ERROR:
> > Error Type:
> > Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
> > Multiple-step OLE DB operation generated errors. Check each OLE DB status
> > value, if available. No work was done.
> > /sailors/registrationconfirmation.asp, line 34
> >
> > Please note the line 34 is the following:
> > rs("PeopleReferee") = Request.Form("chkReferee")
> >
> > Thanks for any help in advance.
> >
> >
>
>
>

Re: Problem with checkbox in registrationconfirmation page

am 17.11.2004 00:37:27 von reb01501

Not if you use saved parameter queries:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=eHYxOyvaDHA.4020%40tk2msftngp13.phx.gbl

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=ukS%246S%247CHA.2464%40TK2MSFTNGP11.phx.gbl

http://www.google.com/groups?selm=eETTdnvFDHA.1660%40TK2MSFT NGP10.phx.gbl&oe=UTF-8&output=gplain

http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&sel m=e6lLVvOcDHA.1204%40TK2MSFTNGP12.phx.gbl




Jack wrote:
> Thanks for your input Ray. The backend is actually an Access
> database. If I need to add a record from a form having 30-40 fields
> to a database, does the sql statement not become ugly with the insert
> method as compared to addnew method? Thanks.
> "Ray Costanzo [MVP]" wrote:
>
>> First, please stop with the recordset.addnew stuff. That is not the
>> correct way to add a new record. Second, please stop using an ODBC
>> connection. For one thing, if you were using an OLE DB connection,
>> you'd most likely get a more informative error.
>>
>> If the checkbox is not checked, Request.Form("chkReferee") will not
>> contain any data. So, you need to handle that. I don't see
>> anywhere that you indicated what kind of database you're using or
>> what datatype PeopleReferee is, so I'll assume SQL Server and bit.
>>
>> If you CInt your data, if it's empty, it will become zero.
>>
>> iPeopleReferee = CInt(Request.Form("chkReferee"))
>>
>> Please see here for the proper way of inserting data:
>> http://www.aspfaq.com/show.asp?id=2191
>>
>> Ray at work
>>
>>
>>
>> "Jack" wrote in message
>> news:EC160077-D091-49C9-BCD4-7A4A3DC1AE20@microsoft.com...
>>> Hi,
>>> I have part of a form as following:
>>>
>>> Referee
>>>
>>>
>>>
>>> In the above a checkbox is placed in a form which uses POSt method
>>> to write
>>> to database.
>>>
>>> The registrationconfirmation.asp page writes to the database after
>>> collecting the information from the form.
>>> The following is part of the code to write to database
>>>
>>> rs.addnew
>>> 'Set the table column = to my input text box from my form
>>> rs("PeopleNameFirst") = Request.Form("txtFirstName")
>>> rs("PeopleNameLast") = Request.Form("txtLastName")
>>> rs("PeopleState") = Request.Form("txtState")
>>> rs("PeopleDOB") = Request.Form("txtDateofBirth")
>>> rs("PeopleReferee") = Request.Form("chkReferee")
>>> rs("PeopleProfessionalClass") = Request.Fo >>> HREF="register.asp">register.asprm("optClass")
>>> rs("PeopleClubCode") = Request.Form("lstClubs")
>>> rs.update
>>> %>
>>>
>>> Now when I check the chkReferee field the record is getting added
>>> to the database. However, when i do not check the chkReferee field
>>> then an error message is coming and record does not get added to
>>> the database.
>>> ERROR:
>>> Error Type:
>>> Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
>>> Multiple-step OLE DB operation generated errors. Check each OLE DB
>>> status value, if available. No work was done.
>>> /sailors/registrationconfirmation.asp, line 34
>>>
>>> Please note the line 34 is the following:
>>> rs("PeopleReferee") = Request.Form("chkReferee")
>>>
>>> Thanks for any help in advance.

--
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"