Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 7th, 2005, 03:58 PM
Authorized User
 
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default inserting yes/no value into Access DB using ASP

Hi,
I have a form that inserts info into a recordset of an Access DB, i want to add an insert for a yes/no data type using a checkbox. The Field Name is WCIcon, normally you put the WCIcon
value="<%=strWCIcon%>" but here the checkbox value is off or on. Any suggestions

<input type="checkbox" name="C1" value="off">


I then want to list all records, both ones with the ICon turned on and ones with the icon turned off. here is the code.

<%for i=1 to 3%>
      <td width="403" valign="top" colspan="2" height="9">
      <%if WCIcon=1 then%> <img border="0" src="webcast/Icon_ON.gif"><%else%><img border="0" src="webcast/Icon_OFF.gif">< <%end if%>
      <b><%=frmDate(rs("pressdate"))%></b><br>
        <%=left(rs("pressTitle"),100)%><%if len(rs("pressTitle"))>60 then Response.Write "..."%></a></td>
          </tr>
<%rs.movenext
next%>




thnks
Pablo


 
Old September 20th, 2005, 12:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How about this:
Code:
Dim Rs
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open SomeSQLStatement, SomeConnection, 1, 3
If Trim(Request.Form("C1")) = "off" Then
  Rs("WCIcon") = True
Else
  Rs("WCIcon") = False
End If
Rs.Update
Rs.Close
Set Rs = Nothing
As a note - checkboxes can't have values of off or on, they're either one thing or they're nothing, so in your example, the value would be "off" if it was checked.

I am a loud man with a very large hat. This means I am in charge





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.Net, Access DB, and a webform? TheNinthPlayer BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 8 June 3rd, 2008 10:28 AM
Inserting records to Oracle db from asp page jowjow Classic ASP Basics 0 April 4th, 2006 09:24 AM
Problem with inserting data into an Access DB donrafeal ASP.NET 2.0 Basics 0 January 6th, 2006 05:34 PM
Inserting into access db using VWD. Peki ASP.NET 2.0 Basics 1 April 11th, 2005 09:12 PM
Error When Trying to Search in Access DB Using ASP mvollmer Classic ASP Databases 3 October 10th, 2003 10:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.