jrb47 0 Newbie Poster

I generally do not work in asp however I am working on a project for a volunteer student org - they are working with pregnant teens.

I have the following code and while I can get the names and address to pass I can not get the checkbox to pass true or 1 when checked.
regardless of what I try the data is registering as False - which tells me that a true value is not being passed correctly.

below is both the aspx code and the html code

aspx code

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script language="VB" runat="server">

    Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)

        Dim objConnection As OleDbConnection
        Dim objCmd As OleDbCommand
        Dim strConnection As String
        Dim strSQL As String
	
        strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
            "Data Source=Teens.mdb"
  
        ' Create and open the connection object
        objConnection = New OleDbConnection(strConnection)
        objConnection.Open()
	
	
        strSQL = "INSERT INTO teens(Pname, Paddress, Delivered) VALUES (?, ?, ?)"
	
	
        ' Create the Command and set its properties
        objCmd = New OleDbCommand(strSQL, objConnection)
        objCmd.Parameters.Add(New OleDbCommand("text1", Request.Form("text1")))
        objCmd.Parameters.Add(New OleDbCommand("text2", Request.Form("text2")))
        objCmd.Parameters.Add(New OleDbCommand("text3", If(Request.Form("text3") IsNot Nothing AndAlso Request.Form("text3").Lenth > 0, Request.Form("text3"), "False")))
        ' execute the command
        objCmd.ExecuteNonQuery()

        lblStatus.Text = "Command run"

    End Sub

</script>

<html>
  <body>
	<h2>Insert Data into Table</h2>
	<asp:Label id="lblStatus" runat="server"/>
	<p>
	   
  </body>
 
</html>

html form code

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body>
<form runat="server" action = "InsertNames.aspx" method = "post">
      
      Please enter  Patients Name:
      <input type = "Text" name = "text1"   style="color: red" size="20" />
      <br /><br />
      
      Please enter Patients Address:
      <input type = "Text" name = "text2"   style="color: red" size="20" />
      <br /><br />
      
      Delivered:
    <input id="text3" type="checkbox" value="True" />

    <br /><br />
      <input type="Submit">
  </form>

</body>

</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.