ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 16th, 2012, 05:53 PM
grissom grissom is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 53 grissom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 35 m 11 sec
Reputation Power: 9
Smile Preview the searc result in the same page as the form

Hi

I have two .asp pages. One holds the searh form and the second holds the asp code and also shows the result of the search. This works as two pages.

My problem is that I need this to be one page. I need to have the search form on top and the result should show up below. But trying to integrate the two always gives me an error message.

Here is the code from the pages:
page1
<form id="search" name="search" method="post" action="form2.asp">
<p>
<label>
Org. nr.<br />
<input type="text" name="org" id="org" />
</label>
</p>
<p>
<label>
Resultat<br />

</label>
</p>
<p>
<label>
<input type="submit" name="Hent" id="Hent" value="Hent" />
</label>
</p>
</form>


Page2 (form2.asp)
Code:
<%  
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable, adOpenStatic
adOpenForwardOnly = 0
adLockReadOnly = 1
adOpenStatic = 3 
adCmdTable = 2

Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")

	objConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\home\studio36\www\Databaser\kunder.mdb;Persist Security Info=False"
	
Dim strSearch, strCriteria
strSearch = Request.Form("org")

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.open "kunder", objConn, adOpenStatic, adLockReadOnly, adCmdTable

strCriteria = "Org-nr='" & strSearch & "'"

objRS.Find strCriteria

If objRS.EOF Then 
Response.write "Det finnes ikke informasjon om dette org.nr." & strSearch 
	Else 
Response.Write "<strong>Org. nr.:</strong>" & objRS("Org-nr") & "<br />" &_
	  "<strong>Navn:</strong>" & objRS("Navn") & "<br />" &_
	  "<strong>Tlf:</strong>" & objRS("Tlf") & "<br />" &_
	  "<strong>Mobil:</strong>" & objRS("Mobil") & "<br />" &_
	  "<strong>E-post:</strong>" & objRS("E-post") & "<br />"  
	End if  
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>


Any help on combining these two would be greatly appreciated.


Reply With Quote
  #2  
Old May 16th, 2012, 09:34 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,233 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 14 h 15 m 56 sec
Reputation Power: 4445
Sounds like you want to use some ajax in your page, possibly by using jquery or similar.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #3  
Old May 17th, 2012, 05:20 AM
grissom grissom is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 53 grissom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 35 m 11 sec
Reputation Power: 9
Search form and result on the same page

I am not very familiar with Ajax or Jquery. I have tried to put everything together in one page, and if you take a look at http://www.studio36.no/form20.asp , you will see the error just below the form. If you search for a organisation number like 940 060 192 you'll see the information below the form.

This is just what I want. I just need to get the initial error message out of the way and I have no idea on how to do that.

Here is the code from the page.

Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% option explicit %>

<%  
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable, adOpenStatic
adOpenForwardOnly = 0
adLockReadOnly = 1
adOpenStatic = 3 
adCmdTable = 2

Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")

	objConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\home\studio36\www\Databaser\kunder.mdb;Persist Security Info=False"
	'objConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\inetpub\wwwroot\nina-saether\www\Databaser\kunder.mdb;Persist Security Info=False"
	
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.open "kunder", objConn, adOpenStatic, adLockReadOnly, adCmdTable

Dim strSearch, strCriteria
strSearch = Trim(Replace(Request.Form("org"), "'", "''"))
strSearch = Request.Form("org")
strCriteria = "Org-nr='" & strSearch & "'"
'strCriteria = strSearch 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>bedriftsresevasjon</title>
</head>

<body>

<form id="search" name="search" method="post" action="form20.asp">
  <p>
    <label>
      Org. nr.<br />
      <input type="text" name="org" id="org" />
    </label>
  </p>
  <p>
    <label>
      <input type="submit" name="Hent" id="Hent" value="Hent" />
    </label>
  </p>
</form>
<%  

objRS.Find strCriteria 

If objRS.EOF Then 
Response.write "Det finnes ikke informasjon om dette org.nr." & strSearch 
	Else 
Response.Write "<strong>Org. nr.:</strong>" & objRS("Org-nr") & "<br />" &_
	  "<strong>Navn:</strong>" & objRS("Navn") & "<br />" &_
	  "<strong>Tlf:</strong>" & objRS("Tlf") & "<br />" &_
	  "<strong>Mobil:</strong>" & objRS("Mobil") & "<br />" &_
	  "<strong>E-post:</strong>" & objRS("E-post") & "<br />"  
	End if  
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</body>
</html>


If you could please tell med where I went wrong I would be really greatful.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Preview the searc result in the same page as the form

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap