Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Help Nedded in Ordering....
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

CooLGiL
Junior Member

126 Posts

Posted - 24 May 2002 :  14:19:17  Show Profile  Send CooLGiL an ICQ Message
Hi All, i Have A Table like that:

ID=AutoNumber
Name=text
Profile=text
----------------------
| ID | name | profile|
----------------------
| 1 | admin | blaaaa|
| 2 | asdas | fdasd|
| 3 | sdfas | dsfass|
| 4 | bvfee | asdfa |
| 5 | gdsfv | df ra |
| 6 | ccccc | dde3ws|
----------------------

Now Im Showing My User That Table And I Wanna Do That I wIll Bee Able To Oeder The Table I Mean Im Showing Him And Im Giving Him A Button to Up And One To Down And I Want When He Click The Down It Will Go Down And Ehrn HE Click The Up It Will GO 1 Up.

Thanks Ahed!

redbrad0
Advanced Member

USA
3725 Posts

Posted - 24 May 2002 :  14:38:12  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
im so lost, you want to display one record per a page and let him click previous and next and be able to go thru all the members?

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 24 May 2002 :  14:47:16  Show Profile  Send CooLGiL an ICQ Message
NO, Man No!

Im The Admin.
I Wanna Order The Table As I Want and in the asp page not by editing the table.
So I Wanna Make A button next to the record so when i click the up buttonit will go one yo and when i click down it will go one down!
look here:

-----------------------------------------------------------------
this is the document that show's the table:
-----------------------------------------------------------------

----------------------
| ID | name | profile|
----------------------
+ -| 1 | admin | blaaaa|
+ -| 2 | asdas | fdasd|
+ -| 3 | sdfas | dsfass|
+ -| 4 | bvfee | asdfa |
+ -| 5 | gdsfv | df ra |
+ -| 6 | ccccc | dde3ws|
----------------------

now leths say i clicked on the plus in number 4 iwant him to go up! i want him to be 3 and 3 to be 4 and the if i clec minus then it will do the same just the opasite

Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 24 May 2002 :  14:52:43  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
I'm confused to. You said "not by editing the table" so do you mean you want the order in the database to remain the same but you want a new order just displayed? So the next time you go the page the order is how it was the previous time you saw it?

@tomic

http://www.skepticfriends.org
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 24 May 2002 :  15:22:50  Show Profile  Send CooLGiL an ICQ Message
Danm, No!
I Meant I DOnt Want To Edit The Table With My Hands I DOnt Wanna Open TheDataBase And Order The Table.
I Wanna Do It From The Form.
Si I Will Be Able To Set The Order Of The Fields! i wrote evverthing i want can some one help me?

Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 24 May 2002 :  15:29:13  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
quote:

Danm, No!
I Meant I DOnt Want To Edit The Table With My Hands I DOnt Wanna Open TheDataBase And Order The Table.
I Wanna Do It From The Form.
Si I Will Be Able To Set The Order Of The Fields! i wrote evverthing i want can some one help me?




CoolGil, calm down. He didn't totally understand what you wanted so he asked for clarification

To get the effect you want, you are going to need to create a hidden field that you will use to sort by. That's the only way I know of to achieve the result you want.

Dave Maxwell
--------------
Proud to be a "World Class" Knucklehead
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 24 May 2002 :  15:57:16  Show Profile  Send CooLGiL an ICQ Message
hmm, is any one know hoe can i do that???
its really important...

Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 24 May 2002 :  16:19:49  Show Profile  Send CooLGiL an ICQ Message
Comon Pll, i know some of you know how to do that! and its really important!

Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 24 May 2002 :  16:27:14  Show Profile
do you already have the page coded? If so, it would be very, very helpful if you posted a link to it.

Also, begging and demanding for help will get you nowhere. Ask nicely and be patient, you will get better results.
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 24 May 2002 :  16:33:55  Show Profile  Send CooLGiL an ICQ Message
i know you right.
it's just my english not so good...
im 12 years old from israel! so lets say my heebrew is better then my english...
Now, What Page Do You Want Me To Show?
I Can Show You The Page That Show The Table But Its Mot Complacated!
its Just And Connection and then some rs's that shows the page i will show it to you:

<%

set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("***.mdb")

Conn.Errors.Clear

set rs = Server.CreateObject("ADODB.Recordset")

Sql = "SELECT * FROM crew"
set rs = Conn.Execute (Sql)

DO UNTIL rs.EOF
response.write "<tr><td bordercolor=green dir=rtl><p align=left>" & rs("Profile") & "</p></td><td bordercolor=green dir=rtl><p align=left>" & rs("Name") & "</p></td></tr>"
rs.movenext
LOOP

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


well, i already wrote the table so i dont need to include anything!
please help me! im despared...



Edited by - CooLGiL on 24 May 2002 16:35:09
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 24 May 2002 :  20:12:46  Show Profile  Visit Gremlin's Homepage
Ok I've created this for you, which should work, but I don't guaruntee it.


<%
'---------------------------------
' Get our Record Set into an Array
'---------------------------------
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("***.mdb")
Conn.Errors.Clear
set rs = Server.CreateObject("ADODB.Recordset")
Sql = "SELECT * FROM crew"
set rs = Conn.Execute (Sql)
if not rs.EOF then
MyArray = rs.GetRows()
rs.Close()
set rs = nothing
Conn.Close()
set Conn = nothing
NumCols = ubound(MyArray,1)
NumRows = ubound(MyArray,2)
else
NumCols = 0
NumRows = 0
end if


'---------------------------------------
' Determine Sort order requested by User
'---------------------------------------
req = Request("sortBy")
If Len(req) < 1 Then sortBy = 0 Else sortBy = CInt(req)
req = Request("priorSort")
If Len(req) < 1 Then priorSort = -1 Else priorSort = CInt(req)
If sortBy = priorSort Then
reverse = true
priorSort = -1
Else
reverse = false
priorSort = sortBy
End If


'-----------------------------
' Heres where the work is done
'-----------------------------
Dim SortArray()
ReDim SortArray(NumRows)
' Put the data into an Array of Arrays
For RowCount = 0 to NumRows
MyData = ""
For ColCount = 0 to NumCols
MyData = MyData & MyArray(ColCount,RowCount) & "|"
next
MyData = left(MyData,Len(MyData)-1) ' Remove last pipe
tempArray = split(MyData,"|")
SortArray(RowCount) = tempArray
next


' Determine field type for sorts ie String or Number
If VarType( SortArray( 0 )( sortBy ) ) = 8 Then
If reverse Then kind = 1 Else kind = 2 ' sorting strings...
Else
If reverse Then kind = 3 Else kind = 4 ' non-strings (numbers, dates)
End If


'----------------------------------------
' Sort the data with a simple bubble sort
'----------------------------------------
For i = ubound(SortArray) TO 0 Step -1
minmax = SortArray( 0 )( sortBy )
minmaxSlot = 0
For j = 1 To i
Select Case kind ' which kind of sort are we doing?
Case 1 ' string, reverse...we do case INsensitive!
mark = (strComp( SortArray(j)(sortBy), minmax, vbTextCompare ) < 0)
Case 2 ' string, forward...we do case INsensitive!
mark = (strComp( SortArray(j)(sortBy), minmax, vbTextCompare ) > 0)
Case 3 ' non-string, reverse ...
mark = (SortArray( j )( sortBy ) < minmax)
Case 4 ' non-string, forward ...
mark = (SortArray( j )( sortBy ) > minmax)
End Select
' so is the current slot bigger/smaller than the remembered one?
If mark Then
' yep, so remember this one instead!
minmax = SortArray( j )( sortBy )
minmaxSlot = j
End If
Next
' is the last slot the min (or max), as it should be?
If minmaxSlot <> i Then
' nope...so do the needed swap...
temp = SortArray( minmaxSlot )
SortArray( minmaxSlot ) = SortArray( i )
SortArray( i ) = temp
End If
Next


'---------------------
' Now Display our page
'---------------------
%>
<FORM Name="doSort" Method="Get">
<INPUT Type=Hidden Name=priorSort Value="<% = priorSort %>">
<INPUT Type=Hidden Name=sortBy Value="-1">
</FORM>

<SCRIPT Language="JavaScript">
function reSort( which )
{
document.doSort.sortBy.value = which;
document.doSort.submit( );
}
</SCRIPT>

<TABLE Border="1" cellPadding="4" cellspacing="0">
<TR>
<TH align="left"><A HREF="javascript:reSort(0);">RecordId</span></A></TH>
<TH align="left"><A HREF="javascript:reSort(1);">Name</span></A></TH>
<TH align="left"><A HREF="javascript:reSort(2);">Profile</span></A></TH>
</TR>
<%


'------------------------------------
' Now Display our nicely sorted table
'------------------------------------
For i = 0 To NumRows
Response.Write " <TR>" & vbNewLine
For j = 0 To UBound( SortArray(i) )
Response.Write " <TD>" & SortArray(i)(j) & "</TD>" & vbNewLine
Next
Response.Write " </TR>" & vbNewLine
Next
%>
</TABLE>


www.daoc-halo.com

Edited by - Gremlin on 24 May 2002 20:16:41
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 24 May 2002 :  20:13:59  Show Profile  Visit Gremlin's Homepage
To resort the table order you just click on the column heading.

www.daoc-halo.com
Go to Top of Page

alex042
Average Member

USA
631 Posts

Posted - 24 May 2002 :  23:40:48  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
quote:
To resort the table order you just click on the column heading.


It sounds like he wants to manually sort members, not necessarily alphabetically or by whole column.


Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 25 May 2002 :  00:00:39  Show Profile  Visit Gremlin's Homepage
Yeah I think your right, I couldn't make heads or tails of his request to be honest.



www.daoc-halo.com
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 25 May 2002 :  00:03:21  Show Profile  Visit Gremlin's Homepage
CoolGil take a look at the page admin_config_order.asp in Snitz, I think that perhaps is closer to what you want, is just uses dropdown boxes to allow you to change the order of the items.

www.daoc-halo.com
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 25 May 2002 :  02:41:51  Show Profile  Send CooLGiL an ICQ Message
Gremlin, i really apreshate your help to me.
but, what you maked cant help me...
cuase i want to use sql statment to make that i want that the record will really change.
I want here tochange like that:

id-name-profile
+-1-gil-cool
+-2-dana-smart
+-3-uzi-big
+-4-rivi-small
+-5-bani-good
+-6-dalit-stupid

i want when i click next to dana smart minus i want here to go down or else i click plus and she come up like that:

id-name-profile
+-1-dana-smart
+-2-gil-cool
+-3-uzi-big
+-4-rivi-small
+-5-bani-good
+-6-dalit-stupid

Nw Gremlin if you will write me a code please explain evething becuase i didnt urdenstand alot of staff in the code you wrote me so can you explain it to me?
"
ubound(MyArray,1)
"
"
rs.GetRows()
"
CInt(req)
"
Len(req)
"
reverse
"

and if you can give me a site that i can improve my abilities i will be greate full!
thankx ahed



Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.26 seconds. Powered By: Snitz Forums 2000 Version 3.4.07