Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 August 6th, 2004, 11:23 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default Check boxe pulling data

 Here's what I am trying to achieve. I have one drop down menu and three check boxes. the check boxes diplays as follows.
1) Says"Open" 2) Says"Pending Research" 3)Says"Close". When the user Chooses one of the work order in the drop down menu Next choose an open check box and then hit the submit button. It should diplay all information where the table is displaying along with the correct work order and all the jobs that are open. I hope this makes sense.

Code
<%

Dim objConn, objRS, ObjField, strSQL, strStatus


set objConn=Server.CreateObject("ADODB.CONNECTION")

ObjConn.Open "Provider=sqloledb;Data Source=Flmirsql02;Initial Catalog=Source_Forms;User Id=Source_Forms_User;Password=password;"

Set objRS = Server.CreateObject("ADODB.Recordset")


If Len(Request.Form("Escalation_Type")) <> " " Then
strStatus = request.form("Status")

strSql = "SELECT Top 7 * FROM Escalation_Forms WHERE Escalation_Type = '"& Replace(Request.QueryString("Escalation_Type"), "'", "''") &"'"

Set ObjRS = ObjConn.Execute(strSql)
'Response.Write(strSQL)
'Response.end




'Show records

%>
<table border="2">
            <tr>
                <th bgcolor="#000000"><strong>Ticket Number</strong></th>
                <th bgcolor="#000000"><strong>Escalation Type</strong></th>
                <th bgcolor="#000000"><strong>First Name</strong></th>
                <th bgcolor="#000000"><strong>Last Name</strong></th>
                <th bgcolor="#000000"><strong>Account Number</strong></th>
                <th bgcolor="#000000"><strong>Phone Number</strong></th>
                <th bgcolor="#000000"><strong>CAE Name</strong></th>
                <th bgcolor="#000000"><strong>Customer Comment</strong></th>
                <th bgcolor="#000000"><strong>Status</strong></th>
                <th bgcolor="#000000"><strong>Feed Back</strong></th>
                </tr>

<%

do until ObjRS.eof
  ' Loop through the records here



                Response.Write ("<tr>")

                   Response.Write("<td><a href='Results.asp?TicketNum=" & objRS("Ticket_Number") & "'>" & objRS("Ticket_Number")& "</a></td>")
                Response.Write "<td>" & objRS("Escalation_Type") &"</td>"
                Response.Write "<td>" & objRS("First_Name") &"</td>"
                Response.Write "<td>" & objRS("Last_Name") & "</td>"
                Response.Write "<td>" & objRS("Account_Number") & "</td>"
                Response.Write "<td>" & objRS("Phone_Number") & "</td>"
                Response.Write "<td>" & objRS("Cae_Name") & "</td>"
                Response.Write "<td>" & objRS("Cust_Com") & "</tr></td>"
                Response.Write "<td>" & objRS("Status") & "</td>"
                Response.Write "<td>" & objRS("Wip_Com") & "</td>"


  ObjRS.movenext
loop

%>

    </table>

<%


Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open "Escalation_Forms", objConn, 0, 1



'Loop through recordset and display results




If Not objRS.EOF Then




objRS.MoveNext

'the form below calls this file only this time with an id in the QueryString
%>



<p>&nbsp;</p>



    <form action="Eta_database4.asp" method="get" style="text-align: center">

    <option value="<%= objRS.Fields("Escalation_Type") %>"></option>


    <select name="Escalation_Type" size="1">
        <option selected>Choose One</option>
        <option>Eta</option>
        <option>HDTV Call Back</option>
        <option> Supervisor Call Back</option>
    </select>&nbsp;&nbsp;&nbsp;


<b>Open:</b><input type="checkbox" name="Status" value="Open">


<b>Pending Research:</b><input type="Checkbox" name="Status" value="Pending Research ">&nbsp;


<b>Close:</b><input type="checkbox" name="Status" value="Close">


<p>

    <input type="submit" value="Submit"/>

    <INPUT type="reset" value="Clear"></p>

    </form>
<%


End If

End If

' Close Data Access Objects and free DB variables
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>

</body>
</htm>

 
Old August 6th, 2004, 11:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Is this any different than your previous post in the other forum?

Brian
 
Old August 6th, 2004, 12:02 PM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes it is ! Works but when selecting an open check box it doesn't retrieve that information. I was going the wrong way about it the first time.

 
Old August 7th, 2004, 02:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Calibus,

I am not sure what you are trying to do here.

Code:
objRS.Open "Escalation_Forms", objConn, 0, 1
'Loop through recordset and display results
If Not objRS.EOF Then
how many rows does "Escalation_Forms" return? Are you trying 
to loop through the recordset? If so, where is the "While NOT objRs.EOF",
but you just have a "objRS.MoveNext" below.
objRS.MoveNext

'the form below calls this file only this time with an id in the QueryString
%>

<p>&nbsp;</p>
Your form's METHOD is GET, but you are requesting values using Request.FORM() 
on top of this page. I am not sure if this FORM submits to the same page. 
If submitted to same page, REQUEST.FORM() is the wrong way of getting values.
<form action="Eta_database4.asp" method="get" style="text-align: center">
Why is this Option tag oustide the SELECT tag?
    <option value="<%= objRS.Fields("Escalation_Type") %>"></option>

    <select name="Escalation_Type" size="1">
Escalation_Type will hold nothing if any of the following Options chosen, 
coz' you haven't given any of those a VALUE listed below.
        <option selected>Choose One</option>
        <option>Eta</option>
        <option>HDTV Call Back</option>
        <option> Supervisor Call Back</option>
    </select>&nbsp;&nbsp;&nbsp;
    If you are very much bothered about the checkbox values
getting displayed than correcting other errors, then replace this code on top of the page.

'If Len(Request.Form("Escalation_Type")) <> " " Then
'strStatus = request.form("Status")
Response.write request("Escalation_Type")
Response.write request("Status")

Escalation_Type will still hold nothing. Status would display something if any value is checked.

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
SSIS Not pulling data correctly chevy SQL Server 2005 0 February 26th, 2008 04:12 PM
Ajax not pulling back data gmoney BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 August 22nd, 2006 02:31 AM
pulling data from webpage zeeonline XSLT 3 July 27th, 2006 03:04 PM
Pulling data from the selected recordin the DGRID MDM ASP.NET 2.0 Professional 6 April 9th, 2006 09:36 PM
placeholder controls -- pulling data Fubar ASP.NET 1.0 and 1.1 Professional 6 September 8th, 2005 09:08 AM





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