Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #21 (permalink)  
Old June 28th, 2005, 03:54 PM
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is a little tidbit on the multiple page repeat region:
Not the whole string (web address removed)

?tower=01%2C+02%2C+03&date_storefrom=01%2F01%2F200 5&date_storefrom_Month=0&date_storeto=06%2F28%2F20 05
&date_storeto_Month=5&Submit=Submit+Query&offset=8 0

I can tell that the code that grabs the sql string is garbling the querystring - this should be tower IN ('01', '02', '03')

what I get fro results is all the data. I know it is in the querystring becasue if I set the numrows to 200 it will only display the seleted data.

Can't quite figure out where to begin - just tons of random looking code on the page.

Chris

Reply With Quote
  #22 (permalink)  
Old June 29th, 2005, 01:17 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
quote:You could deploy a little trick in the display of the list items. It's a bit dirty, hard to understand if someone else must change your code later, and it might break other stuff.
I guess this was the breaking stuff I was talking about ;)

The odd characters you see are escaped versions of the ' character that cannot be passed in a normal Url. Usually, this won't be a problem as they are often unescaped again automatically. They do, however, make debugging more difficult.

How come you have '1', '2', '3' in your query string? I thought you were going for the For loop??

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #23 (permalink)  
Old June 29th, 2005, 02:06 PM
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I opted for the replace method - still a loop (kind of) I guess the problem i have now is getting my repeat region working properly. I don't completely understand querystring in urlencode - but there is something wrong with it. I know it isn't passsing date values correctly either. If I just select dates - leaving everything else off - it still creates the same error. Just as an example - and maybe this problem should be posted as a new discussion:

Here is the SQL String:
SQL is SELECT * FROM tblsamples WHERE Date_Stored BETWEEN #01/01/2005# AND #06/29/2005# and Tower in ('01','02','03','04','05')

Here is the resulting querystring from the repeat region:
?tower=01%2C+02%2C+03%2C+04%2C+05&box=%2A&upn=%2A& date_storefrom=01%2F01%2F2005&date_storefrom_Month =0&
date_storeto=06%2F29%2F2005&date_storeto_Month=5&u pna=%2A&Submit=Submit+Query&offset=40

what do you think?

Reply With Quote
  #24 (permalink)  
Old June 29th, 2005, 02:22 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Try this:

<%
  Response.Write(Unescape(The escaped string you just posted))
%>

Does it look like you expected?

Maybe a new topic is indeed better.

Another suggestion to make things more manageable:

Create a separate function that creates the WHERE clause for the Sql statement. Something like:

Function MakeWhere()
  ' In here, get stuff from the query string or other variables and build up a where
End Function

Then use that in your Sql statement:

bla bla bla WHERE " & MakeWhere()

This might make it easier to manage your code....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #25 (permalink)  
Old June 29th, 2005, 02:51 PM
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the unescaped version - I can tell that it is pulling stuff that is not in the sql string (ie. box, upn, upna) Not to mention that the tower & date fields are not the same.

?tower=01, 02, 03,04,05&box=*&upn=*&date_storefrom=01/01/2005&date_storefrom_Month=0
&date_storeto=06/29/2005 &date_storeto_Month=5&upna=*&Submit=Submit Query&offset=40

Reply With Quote
  #26 (permalink)  
Old June 29th, 2005, 03:15 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

If you use Dreamweaver's paging methods, it preserves everything that is on the querystring when you go to the next page. If you have a GET based form, that will be everything that is in your form, including text boxes and drop-down controls....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Blindspot by Bitmonx (Track 3 from the album: Irresistible Meltdown Vol. 2) What's This?
Reply With Quote
  #27 (permalink)  
Old June 29th, 2005, 03:28 PM
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I used the POST method - I can tell it must be pulling data from POST or else the box, upn & upna fields would not be there. If you look at the code I have - I am making my recordset dynamically - the problem with the repeat region appears to be that it is pulling my form data instead of my sql string data. Do you know of anyway to change this - the dreamweaver code is pretty well documented - but in true dw fashion - there is a ton of it!!!!

You certainly don't have to read this - but here is the code for creating the repeat region and the repeat region navigation. Incidently, if I have the data all displayed on one page it is fine (and that may be my solution-except that we could be talking about (44*5*100 rows of data)

<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 40
Repeat1__index = 0
rssample_numRows = rssample_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim rssample_total
Dim rssample_first
Dim rssample_last

' set the record count
rssample_total = rssample.RecordCount

' set the number of rows displayed on this page
If (rssample_numRows < 0) Then
  rssample_numRows = rssample_total
Elseif (rssample_numRows = 0) Then
  rssample_numRows = 1
End If

' set the first and last displayed record
rssample_first = 1
rssample_last = rssample_first + rssample_numRows - 1

' if we have the correct record count, check the other stats
If (rssample_total <> -1) Then
  If (rssample_first > rssample_total) Then
    rssample_first = rssample_total
  End If
  If (rssample_last > rssample_total) Then
    rssample_last = rssample_total
  End If
  If (rssample_numRows > rssample_total) Then
    rssample_numRows = rssample_total
  End If
End If
%>
<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables

Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined

Dim MM_param
Dim MM_index

Set MM_rs = rssample
MM_rsCount = rssample_total
MM_size = rssample_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

  ' use index parameter if defined, otherwise use offset parameter
  MM_param = Request.QueryString("index")
  If (MM_param = "") Then
    MM_param = Request.QueryString("offset")
  End If
  If (MM_param <> "") Then
    MM_offset = Int(MM_param)
  End If

  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsCount <> -1) Then
    If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
      If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' move the cursor to the selected record
  MM_index = 0
  While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
  If (MM_rs.EOF) Then
    MM_offset = MM_index ' set MM_offset to the last possible record
  End If

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

  ' walk to the end of the display range for this page
  MM_index = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = MM_index
    If (MM_size < 0 Or MM_size > MM_rsCount) Then
      MM_size = MM_rsCount
    End If
  End If

  ' if we walked off the end, set the offset based on page size
  If (MM_rs.EOF And Not MM_paramIsDefined) Then
    If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
      If ((MM_rsCount Mod MM_size) > 0) Then
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If

  ' move the cursor to the selected record
  MM_index = 0
  While (Not MM_rs.EOF And MM_index < MM_offset)
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
rssample_first = MM_offset + 1
rssample_last = MM_offset + MM_size

If (MM_rsCount <> -1) Then
  If (rssample_first > MM_rsCount) Then
    rssample_first = MM_rsCount
  End If
  If (rssample_last > MM_rsCount) Then
    rssample_last = MM_rsCount
  End If
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
  MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev

Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam

MM_keepMove = MM_keepBoth
MM_moveParam = "index"

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
  MM_moveParam = "offset"
  If (MM_keepMove <> "") Then
    MM_paramList = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For MM_paramIndex = 0 To UBound(MM_paramList)
      MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
      If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
        MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
      End If
    Next
    If (MM_keepMove <> "") Then
      MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
  End If
End If

' set the strings for the move to links
If (MM_keepMove <> "") Then
  MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
End If

MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="

MM_moveFirst = MM_urlStr & "0"
MM_moveLast = MM_urlStr & "-1"
MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
  MM_movePrev = MM_urlStr & "0"
Else
  MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>

Reply With Quote
  #28 (permalink)  
Old June 29th, 2005, 03:37 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yeah, it also maintains the POST data. You can configure what you want to maintain.

Anyway, not sure what you mean with this:
Quote:
quote:to be that it is pulling my form data instead of my sql string data
The default paging works by getting the necessary information from the form and/or querystring. If you hack your way around Dreamweaver code by changing the Sql statement, you also need to do that for the paging (sql) code.

Sorry I cannot be of much more help; reading DW code over a forum is pretty difficult, especially since I cannot test anything out and ru it in a browser to see how it works....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Bees (Live Mix) by Xerox & Freeman (Track 3 from the album: RETRO (10 Years of Israeli Trance Vol. 2)) What's This?
Reply With Quote
  #29 (permalink)  
Old June 29th, 2005, 03:46 PM
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Imar!

I may just have the data output to excel instead of messing with all of this - I really do appreciate all of your help - hopefully I will be able to reciprocate by helping others in the future!

Chris



Reply With Quote
  #30 (permalink)  
Old June 29th, 2005, 04:26 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

In that case, look at some of the posts from Greg Griffiths: http://p2p.wrox.com/pop_profile.asp?mode=display&id=91

On his web site, he has a number of useful articles about exporting to Excel.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
query result into xls97 worksheet len Access VBA 1 September 26th, 2005 08:51 PM
Show result from query akibaMaila VB.NET 2002/2003 Basics 2 January 18th, 2005 12:43 PM
Unexpected result from the query tsimsha Classic ASP Databases 1 August 23rd, 2004 03:50 AM
Query Result mateenmohd SQL Server 2000 0 November 1st, 2003 03:53 AM
Archiving query result Ned SQL Server 2000 5 October 8th, 2003 03:34 PM



All times are GMT -4. The time now is 12:44 AM.


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