Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remvoving single quote

Status
Not open for further replies.

Maximus007

Technical User
Jul 26, 2004
248
US
When I move the pointer over the link that dipslays Next Page it show the following URL address: & Page=2 and when I click on it. It dipslays the following

How can I remove the single quote form status?

<%@ Language=VBScript %>
<%Option Explicit %>

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>

<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#000000" width="985" height="50" id="table1" bgcolor="#000000">
<tr>
<td width="983" height="50" align="center">
<img border="0" src="LogoMasthead.gif" align="left" width="150" height="45"><img border="0" src="header_level3.jpg" width="828" height="48"></td>
</tr>
</table>
</center>
</div>

<p align="center">
<font face="Impact, Arial, Helvetica, Sans Serif" size="+3">
Database Result </font>
<p align="center">

<font size="6">

<%
Dim objConn, objRS, strSQL

Dim SqlStatus, Sqlselected

Dim nItemsPerPage, nPage, nPageCount

nItemsPerPage =2


set objConn=Server.CreateObject("ADODB.CONNECTION")
ObjConn.Open "Provider=sqloledb;Data Source=Flmirsql02;Initial Catalog=Source_Forms;User Id=Source_Forms_User;Password=password;"


Sqlselected = Request("Escalation_Type")

'SqlStatus =Request("Status")

If Len(Request.Form("Escalation_Type")) <> "" Then

SqlStatus = " And Status = '" & request("Status") & "'"

Else

SqlStatus = 0

End If


Set ObjRS = Server.CreateObject("ADODB.Recordset")
ObjRS.CursorLocation = 3 ' adUseClient

strSql = "SELECT * FROM Escalation_Forms WHERE Escalation_Type = '"& Sqlselected & "'" & SqlStatus

objRS.Open strSql, objConn, 0, 1

Response.Write(strSql)
Response.End

if objRS.eof then

Response.Write ("No records match your request!")

End if

' Set the page size of the recordset

objRS.PageSize = nItemsPerPage


' Response.Write(nItemsPerPage)
'Response.end

' Get the number of pages
nPageCount = ObjRS.PageCount

nPage = CLng(Request.QueryString("Page"))

If nPage < 1 Or nPage > nPageCount Then
nPage = 1

End If




%></font><b><font size="6"> </font>

</b>
<p align="center">

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

<%
' Position recordset to the correct page
ObjRS.AbsolutePage = nPage

Do While Not (ObjRS.Eof Or ObjRS.AbsolutePage <> nPage)

'Loop through the records here

'Show records

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

<%
' First page
'Response.Write "<A HREF=""Start3.asp?Escalation_Type=" & Sqlselected & " & Page=1"">First Page</A>"


' Next page
if CInt(nPage) <> CInt(nPageCount) then

Response.Write "<A HREF=""Start3.asp?Escalation_Type=" & server.htmlencode(Sqlselected) &""& Server.HtmlEncode(SqlStatus) &"&Page=" & nPage + 1 & """>Next Page </A><br><br>"
End if

' Previous page:
if nPage > 1 then

Response.Write "<A HREF=""Start3.asp?Escalation_Type=" & server.htmlencode(Sqlselected) &""& Server.HtmlEncode(SqlStatus) &" &Page=" & nPage - 1 & """>Previous Page </A>"
End if




' Last page
'Response.Write "<A HREF=""Start3.asp?Escalation_Type=" & server.htmlencode(Sqlselected) & "&Page=" & nPageCount & """>Last Page</A>"



'Close Data Access Objects and free DB variables


objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing

%>

<p>


<span style="vertical-align: middle; font-weight: 700">
<b>
<a href=" to Main Menu</a>

</b> </span></p>

</body>

</html>
 
something like this:

Status = '" & Replace(request("Status"),"'","") & "'

Or

Status = " & request("Status") & "

-VJ
 

Thank you for the quick response but I am getting the following error.

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/forms/Start3.asp, line 52

SqlStatus = " And Status = '" & Replace(request("Status"),"'","") & "'

 
Status = '" & Replace(request("Status"),"'","''") & "'


Known is handfull, Unknown is worldfull
 
I believe that the problem I am having is the way this is set up.


Sqlselected = Request("Escalation_Type")


If Len(Request.Form("Escalation_Type")) <> "" Then

SqlStatus = " And Status = '" & request("Status") & "'"

Else

SqlStatus = ""

End If


Set ObjRS = Server.CreateObject("ADODB.Recordset")
ObjRS.CursorLocation = 3 ' adUseClient

strSql = "SELECT * FROM Escalation_Forms WHERE Escalation_Type = '"& Sqlselected & "'" & SqlStatus

objRS.Open strSql, objConn, 0, 1

Here what I am trying to achieve:

The submisson form has a drop down where you can choose the type of job and 3 radio buttons that the user can choose the different type of status to view " Open, pending, and close". The form that recieves the information from the submission form also has a paging feature. I am able to have it page through the record by using the dropdown menu which alows the user to choose the type of job. Right now if I choose a type of job it will find that job and displays all the status for that job type. How can I get it to choose the Status also? Should I redo and have it page through the recordset using the ID number?

Here's the form that receives the information from the submission form.

 
what does that have to do with '???

Known is handfull, Unknown is worldfull
 
I got the following error?
Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/forms/Start3.asp, line 51

SqlStatus = " And Status = '" & Replace(request("Status"),"'","''") & "'
-------------------------------------------------------------------------^

line 51: SqlStatus = " And Status = '" & Replace(request("Status"),"'","''") & "'
 
SqlStatus = " And Status = '" & Replace(request("Status"),"'","''") & "'[COLOR=black red]"[/color]

you're not closing your string statement on the end. so it's trying to make it from the one in the replace function

[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top