Displaying SQL data in ASP?

This is a discussion on "Displaying SQL data in ASP?" within the Classic ASP section. This forum, and the thread "Displaying SQL data in ASP? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 12th, 2007, 21:23
New Member
Join Date: Mar 2007
Location: usa
Age: 50
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Displaying SQL data in ASP?

Not sure if this is the right forum. If this post belongs in a different one let me know.

I have a project that involves an asp page reading data from sql tables. The asp page needs to show:

GuestName
GuestDescription

These are two columns in in the first table called T_ProgramGuests that I need the asp page to read from. The columns are labeled:

GuestName
GuestDescription

The other table called T_ProgramLinks contains two columns called:

URL
Description

I need my asp page to (and I'm not sure if this is right) have containers (or a better term) that holds some logic that reads from these tables. It simply displays the data in the asp form when the user opens the page or refreshes it.

I will provide the limited code I currently have. I know this code isn't perfect or done but it's a start. I'm just not sure exactly how to do this. I sure could use some help.

ASP PAGE CODE

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"
        "http://www.w3.org/MarkUp/Wilbur/HTML32.dtd">
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
        <title>Company Name: - Title</title>
        <link rel="stylesheet" type="text/css" href="screen_layout_l.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="screen_formatting.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="screen_design.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="style.css">
        <script language="JavaScript">
<!--
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    settings = 'height='+h+',width='+w+',top='+TopPosition+',left  ='+LeftPosition+',scrollbars='+scroll+',resizable=  no'
    win = window.open(mypage,myname,settings)
}
//-->
</script>
    </head>

<%'************************************************  **************************
' This page will be used as a test page for Guests and Links
' its purpose is to simply read the guests and links tables then show
' what ever data is in them on the asp page.
'*************************************************  *************************

    Dim conDB
    set con = Server.CreateObject("ADODB.Connection")
    conDB.Open "File Name=E:\Webservice\Company\Company.UDL"
      con.Open "PROVIDER=SQLOLEDB;DATA Source=Machine IP Address Here;Initial Catalog=company_program;User ID=sa;Password=testpassword"
    set recShow = Server.CreateObject("ADODB.Recordset")
    strGuestName = "SELECT * FROM T_ProgramGuests WHERE GuestName LIKE '?' & "'Guest Description'"
     'recShow.Open strSQLShow,con
     'If recShow.EOF Then
       'Response.Write "Records have been retrieved!"
     ' Close and destroy recordsets
        Response.End
        recShow.Close
        con.Close
     ' Close and destroy DB connection
        conDB.Close
        Set conDB = Nothing
        
         %> 

<p>Company Name<left><HR WIDTH="50%" SIZE="1" NOSHADE></left>
Article Headline<br />
3/7/2007 
<br /><br />
Trust in Cyberspace<br /><br />

Your reputation follows you, even into cyberspace. Online reviews, peer comments and user opinions are changing the way we decide to trust other people. Technology reporter John Doe sees current website ratings leading the way to a new 
standard of social acceptance.</p>

<form action="GuestsLinks.asp" method="post">
 Guest Name: <INPUT type="hidden" ID="GuestName" NAME="Guest Name" value=""><br /><br />
  Guest Description: <INPUT type="hidden" ID="GuestDescription" NAME="Guest Description" value="">
</form>
</body>
</html>
Some of this code may not make sense but thats because the correct syntax eludes me and I'm not exactly an asp & sql guru.

Any help is much appreciated!
Reply With Quote

  #2 (permalink)  
Old Jun 3rd, 2007, 07:25
Junior Member
Join Date: Feb 2007
Location: Crowborough UK
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Displaying SQL data in ASP?

Hi I am no expert but it looks like you have missed off the starting <body> tag.
Reply With Quote
Reply

Tags
asp, sql

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why displaying nothing? begeiste PHP Forum 17 Oct 1st, 2007 19:22
<ul> not displaying the same in FF/IE7? PMicro Web Page Design 10 Mar 21st, 2007 18:49
why is it displaying in IE..?? tameem Web Page Design 3 Oct 14th, 2006 06:09
displaying data from my database franknu PHP Forum 20 Jun 16th, 2006 09:43
Need help displaying XML Zhan Web Page Design 5 Aug 19th, 2005 18:47


All times are GMT. The time now is 20:37.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43