Current location: Hot Scripts Forums » Programming Languages » ASP » display data


display data

Reply
  #1 (permalink)  
Old 08-04-03, 03:41 AM
sasi sasi is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
display data

how to display data's from database in a form....my system works like. this.admin have to key in the student's registration number..and the system should be able to search the complete record of the student...n display all info abt the student in a form using asp..plz help...

Last edited by sasi; 08-06-03 at 03:38 AM.
Reply With Quote
  #2 (permalink)  
Old 08-06-03, 03:40 AM
BuildHome BuildHome is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Israel
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
First of all, you know to display normal data ?
Reply With Quote
  #3 (permalink)  
Old 08-06-03, 03:41 AM
sasi sasi is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
YES OF COURSE....
Reply With Quote
  #4 (permalink)  
Old 08-06-03, 03:52 AM
BuildHome BuildHome is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Israel
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
OK, great.

Now you only need to build a form, like this one:
Code:
<form action="search_action.asp" method="post">
Keyword:<br>
<input type="text" size="25" name="keyword">
<input type="submit" value="Search!">
</form>
Let's say that your search page Is "search_action.asp".
Write (or copy) this code:
Code:
<%
keyword = Request.Form("KeyWord")

SQL = "Select * from tbl where body='%"&keyword&"%';"
%>
And this will display all the data that like the keyword value from the form.

OK ?

Last edited by BuildHome; 08-06-03 at 03:58 AM.
Reply With Quote
  #5 (permalink)  
Old 08-06-03, 05:00 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally posted by BuildHome
OK, great.

Now you only need to build a form, like this one:
Code:
<form action="search_action.asp" method="post">
Keyword:<br>
<input type="text" size="25" name="keyword">
<input type="submit" value="Search!">
</form>
Let's say that your search page Is "search_action.asp".
Write (or copy) this code:
Code:
<%
keyword = Request.Form("KeyWord")

SQL = "Select * from tbl where body='%"&keyword&"%';"
%>
And this will display all the data that like the keyword value from the form.

OK ?
You also should check for commas and things like that in the keyword variable. If you don't, you are just asking for SQL injection.
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Reply With Quote
  #6 (permalink)  
Old 08-06-03, 05:20 PM
MadDog MadDog is offline
Code Master
 
Join Date: Aug 2003
Posts: 935
Thanks: 0
Thanked 0 Times in 0 Posts
instead of talking about it, show them

Code:
<%
keyword = Request.Form("KeyWord")
keyword = Replace(keyword, "'" "''", 1, -1, 1)

SQL = "Select * from tbl where body='%" & keyword & "%';"
%>
__________________
Drew Gauderman
ASP - MSSQL Coder / Buisness Owner / Coder for Hire!
MSN-ICQ-AIM-YIM in Profile

http://www.iportalx.net an easy ASP portal system.
Reply With Quote
  #7 (permalink)  
Old 08-06-03, 05:52 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally posted by MadDog
instead of talking about it, show them

Code:
<%
keyword = Request.Form("KeyWord")
keyword = Replace(keyword, "'" "''", 1, -1, 1)

SQL = "Select * from tbl where body='%" & keyword & "%';"
%>
I didn't have the time. I was at work.
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
If date is less than today do not display jimthepict ASP 5 10-19-03 10:43 PM
QueryString and retrieve data from database pjm ASP 3 08-11-03 02:21 PM
Print data by date perleo PHP 2 08-09-03 09:35 AM
Manipulating arrays for display in HTML madsurfer007 PHP 3 08-07-03 08:26 PM
cannot display the complete data najmun PHP 2 07-04-03 02:52 PM


All times are GMT -5. The time now is 03:04 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.