Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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 June 3rd, 2004, 02:45 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

What do you mean, Dave? Refer to whom where?

Imar
 
Old June 3rd, 2004, 02:52 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

Imar you wrote...
>>And how do you think your application knows where to look for the data? How do you think it finds your Access database or SQL Server database??

My mistake. I messed up the Access connection string on previous page. I assume you were referring to that. I should have also called
variable" an object. This day has been too long man...

 
Old June 3rd, 2004, 03:03 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ha, don't worry.... ;)

I was referring to this:
Code:
objEvents.ActiveConnection = CSRaceResults
This code just assigns an arbitrarily chosen variable name to the ActiveConnection, without actually passing in a valid connection string. Only later I realised the mix between the Recordset and the Command object in the code....

Cheers,

Imar
 
Old June 3rd, 2004, 07:14 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Good morning Guys :-) (Well it's morning here, lol)

Okay I have a question for you referring to this line here

        ' Now display the Placing stuff
        Response.Write(.Fields("BoatName").Value & "(" & _
               .Fields("SailNum").Value & ")<br />")

It is displayed like this boatName(SailNum) with the bracets. How can get it to display without them. Also My original idead was to have column headings for the Html Table, Like this.

(Headings) BOAT NAME SAIL #
(Recordset) BoatName SailNum

Is there any way I can pull this off?

Thanks



-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
 
Old June 3rd, 2004, 07:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

        Response.write "<table>"
        Response.write "<tr><td><b>BoatName</b><td>"
        Response.write "<td><b>Sail #</b><td></tr>"
   Do While Not .EOF
        If .Fields("Event").Value <> OldEventName Then
          OldEventName = .Fields("Event").Value
          Response.Write("<h2>" & .Fields("Event").Value & "</h2>")
        End If
        ' Now display the Placing stuff
        Response.write "<tr><td>"
        Response.Write(.Fields("BoatName").Value & "</td><td>" & _
               .Fields("SailNum").Value & "</td></tr>")
        .MoveNext()
   Loop
Response.write "</table>"

Hope this is what you were looking for.
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 3rd, 2004, 08:01 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay I think I got it I just moved the Do While Not.Eof line, to before the table, like this

   Do While Not .EOF
        Response.write "<table>"
        Response.write "<tr><td><b>BoatName</b><td>"
        Response.write "<td><b>Sail #</b><td></tr>"

        If .Fields("Event").Value <> OldEventName Then
          OldEventName = .Fields("Event").Value
          Response.Write("<h2>" & .Fields("Event").Value & "</h2>")
        End If
        ' Now display the Placing stuff
        Response.write "<tr><td>"
        Response.Write(.Fields("BoatName").Value & "</td><td>" & _
               .Fields("SailNum").Value & "</td></tr>")
        .MoveNext()
   Loop
Response.write "</table>"


-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
 
Old June 3rd, 2004, 08:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

        Response.write "<table>"
   Do While Not .EOF
        If .Fields("Event").Value <> OldEventName Then
          OldEventName = .Fields("Event").Value
Response.Write("<h2>" & .Fields("Event").Value & "</h2>")
          Response.write "<tr><td><b>BoatName</b><td>"

          Response.write "<td><b>Sail #</b><td></tr>"
        End If
        ' Now display the Placing stuff
        Response.write "<tr><td>"
        Response.Write(.Fields("BoatName").Value & "</td><td>" & _
               .Fields("SailNum").Value & "</td></tr>")
        .MoveNext()
   Loop
Response.write "</table>"

Is this what you wanted? Hope I have understood;) that. lol
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 3rd, 2004, 08:31 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks happygv :):):):):):):)

That seems to work great, I just have to add more records and see if they display right.


-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
 
Old June 3rd, 2004, 09:01 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay I know I am a pain but I have another question

When I have more than one record under this line
    ' Now display the Placing stuff
It makes it's own table and it dosen't look right
But if I move the Do while not.eof under the Response.write "<table border=1>" It dosen't work the way I want it too.

So the headings and first record make one table
Then any more records after that make there own table and don't line up under the headings.

  Do While Not .EOF
 Response.write "<table border=1>"

 If .Fields("Event").Value <> OldEventName Then
  OldEventName = .Fields("Event").Value

 Response.Write("<h2>" & .Fields("Event").Value & "</h2>")

 Response.write "<tr><td><b>BoatName</b></td>"
 Response.write "<td><b>Sail #</b></td>"
 Response.write "<td><b>Type</b></td>"
 Response.write "<td><b>Date</b></td>"
 Response.write "<td><b>Position</b></td>"
 Response.write "<td><b>Time</b></td></tr>"

End If

' Now display the Placing stuff

Response.write "<tr><td>"

Response.Write(.Fields("BoatName").Value & "</td><td>" & _
.Fields("SailNum").Value & "</td><td>" & _
.Fields("Type").Value & "</td><td>" & _
.Fields("RaceDate").Value & "</td><td>" & _
.Fields("Position").Value & "</td><td>" & _
 .Fields("RaceTime").Value & "</td><td></tr>")
.MoveNext()
   Loop

Response.write "</table>"

I think I need to loop seperatley through the bottom half under the
' Now display the Placing stuff
so it stays in the same table, instead of going back up to the top and looping through everything again

Thanks


-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
 
Old June 3rd, 2004, 09:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

There was one <TD> extra in your code between the RED code down there, I removed it and rearranged the code. Please see below. New code lines are bolded out.

Code:
 Response.write "<table border=1>"
 Response.write "<tr><td><b>Event Name</b></td>"
 Response.write "<tr><td><b>BoatName</b></td>"
 Response.write "<td><b>Sail #</b></td>"
 Response.write "<td><b>Type</b></td>"
 Response.write "<td><b>Date</b></td>"
 Response.write "<td><b>Position</b></td>"
 Response.write "<td><b>Time</b></td></tr>"
Do While Not .EOF
 If .Fields("Event").Value <> OldEventName Then
  OldEventName = .Fields("Event").Value
 Response.Write("<tr><td colspan=7><h2>" & .Fields("Event").Value & "</h2></td></tr>")
Else
 Response.Write("<tr><td colspan=7>&nbsp;</td></tr>")
End If

' Now display the Placing stuff

Response.write "<tr><td>"
Response.Write(.Fields("BoatName").Value & "</td><td>" & _
.Fields("SailNum").Value & "</td><td>" & _
.Fields("Type").Value & "</td><td>" & _
.Fields("RaceDate").Value & "</td><td>" & _
.Fields("Position").Value & "</td><td>" & _
.Fields("RaceTime").Value & "</td></tr>")
.MoveNext()
   Loop
Response.write "</table>"
Does this work the way you wanted?
Cheers!

_________________________
-Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop through 17 tables in RecordSet object didimichael C# 1 July 18th, 2008 06:53 AM
loop through tables inside .mdb file using VB.NET remya1000 General .NET 3 September 24th, 2007 12:45 PM
creating tables within tables in access??? carswelljr Access 3 August 23rd, 2006 01:21 PM
Help with for-each loop athanatos XSLT 0 April 10th, 2006 07:20 PM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM





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