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 July 23rd, 2003, 03:35 PM
boo boo is offline
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default search page

I must key in FirstName, LastName and IcNo to searching, and it will display the data from member, how to do it? Can u please modify my coding? It display nothing and why display the admin MemberId? Pls show me clearer..
My coding showing below:



<%
'open the database connection
Set con=Server.CreateObject("ADODB.Connection")
'con.open "Provider=SQLOLEDB.1; Password=; UserID=BOO; Initial Catalog=dta; Data Source=webserver;"
con.open "DSN=dta"

Set rs=Server.CreateObject("ADODB.Recordset")
rs.CursorType=adOpenStatic
rs.CursorLocation=adUseServer
rs.LockType=adLockBatchOptimistic

if trim(request.form("FirstName"))<> " " and _
   trim(request.form("LastName"))<> " " and _
   trim(request.form("IcNo"))<> " " then

sql= "Select * from Member where FirstName=' " &_
    trim(request.form("SFirstName")) &_
    "' and LastName='" & trim(request.form("SLastName")) &_
    "' and IcNo='" & trim(request.form("SIcNo")) & "'"
else
    response.redirect "Error_no_record.asp"
end if

con.close
set con=nothing
set rs=nothing
%>



 
Old July 24th, 2003, 04:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

You never populate the recordset object in your code. You have to use this statement after you have assigned a value to sql variable:
Code:
rs.Open sql,con
And then I suppose you would like to display retreived records. The following code piece show one way to realize:
Code:
Do Until rs.EOF
    Response.Write rs("MemberID")
    Response.Write ", "
    Response.Write rs("MemberName")
    Response.Write ", "
    Response.Write rs("OtherField")
    Response.Write "<br>"
    rs.MoveNext
Loop
Of course, you have to use your table fileld's names instead.
HTH.

...but the Soon is eclipsed by the Moon





Similar Threads
Thread Thread Starter Forum Replies Last Post
search page design g2000 ASP.NET 2.0 Basics 1 February 3rd, 2006 12:13 PM
domain search page shine Classic ASP Professional 3 May 12th, 2004 08:13 AM
Search Page Help mvollmer Classic ASP Databases 16 November 19th, 2003 02:53 PM
asp search page help. kyootepuffy Classic ASP Databases 4 September 9th, 2003 10:05 AM
search in an HTML Page Shelly Javascript How-To 1 August 12th, 2003 06:33 PM





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