Just nu i M3-nätverket
Jump to content

ASP/Access order by "ÅÄÖ"


Merkier

Recommended Posts

Jag har ett problem med att lista andvändare i en telefon lista rätt.

 

Den tar Ö som O och ÅÄ som A

 

tex:

Söderlin

Sondermann

Sörensson

Spann

 

Jag vet inte vart felet ligger, om det e via asp sidan eller access databasen

 

 

 

/Merkier

 

Link to comment
Share on other sites

I SQL Server kan man använda COLLATE för landsspecifik sortering, men för Access så hittade jag den här informationen.

 

 

Microsoft Access supports a variety of sort orders to accommodate the sorting conventions of different languages. Sort Orders are enforced at the database level: all tables in a database follow the same sort order. You specify a database's sort order using the Options dialog box under the View menu. The value you specify for sort orders only affects new databases: Changing the sort order under Options does not change the sort order of a database. To change the sort order of an existing database, select the desired sort order in the Options dialog box and then Compact the database. To ensure that your application uses the local sort order, you may want to have the end user compact your database under their local version of Microsoft Access.

 

/PJ

 

Link to comment
Share on other sites

Går jag in i Acces databasen, öppnar tabelen Subscribers o väljer Sort Ascending så lägg dom sig rätt. Vilket får mig o vilja tro att det är asp koden som strular till det :S

 

 

Link to comment
Share on other sites

Hrmm.. det e ganska mkt o ganska klyddigt. Men här e hela iaf. Jag har försökt med Locale Id o LCID på massa olika sätt, men det verkar inte vara det som e problemet heller.

 

<%@ LANGUAGE = VBScript %>

<% Option Explicit %>

 

<HTML>

<HEAD>

<TITLE>****</TITLE>

<base target="_self">

</HEAD>

<body bgcolor=#FFFFFF lang=SV style='tab-interval:65.2pt' topmargin=30 link="#064483">

<!-- Display Header -->

 

<font size="4" face="Arial, Helvetica">

 

 

<p>

<%

 

dim valuemobile

dim strConnection

dim adodb

dim adodb2

dim adors

dim adors2

dim strSQL

dim strSQL2

dim test

dim test2

dim lname

dim titleinfo,honorary

dim misc

dim mailaddress,mobile, mobileshort, department, departmentid ,telnr,away2,trueid,faxno

 

test=Request.QueryString

if test="" then test=2

 

on error resume next

strConnection = "Driver={SQL Server}; Server=****; Database=****; UID=****; PWD=****"

 

Set adoDB = Server.CreateObject("ADODB.Connection")

adoDB.Open strConnection

 

 

Set adoRS = Server.CreateObject("ADODB.RecordSet")

strSQL = "SELECT * FROM subscriber WHERE last_name LIKE '" & test & "%' order by last_name ASC"

adoRS.Open strSQL, adoDB

%>

 

<%

<!--- char_fields -->

Set adoRS2 = Server.CreateObject("ADODB.RecordSet")

strSQL2 = "SELECT recID, value FROM char_fields ORDER BY recID ASC"

adoRS2.Open strSQL2, adoDB

 

 

 

dim i, i2

dim value(1900)

for i=1 to 1900

i2 = adoRS2("recID")

value(i2) = adoRS2("value")

 

adoRS2.movenext

next

 

adors2.close

 

<!--- department -->

Set adoRS2 = Server.CreateObject("ADODB.RecordSet")

strSQL2 = "SELECT name FROM department ORDER BY recID ASC"

adoRS2.Open strSQL2, adoDB

 

 

 

dim z, z2

dim departmentvalue(100)

for z=1 to 100

z2 = adoRS2("recID")

departmentvalue(z2) = adoRS2("name")

 

adoRS2.movenext

next

 

adors2.close

 

 

<!--- extension -->

Set adoRS2 = Server.CreateObject("ADODB.RecordSet")

strSQL2 = "SELECT recID, primary_user_recID FROM extension ORDER BY recID ASC"

adoRS2.Open strSQL2, adoDB

 

 

 

dim y, y2

dim extensionvalue(500)

for y=1 to 500

y2 = adoRS2("primary_user_recID")

extensionvalue(y2) = adoRS2("recID")

 

adoRS2.movenext

next

 

adors2.close

%>

 

</font><b>

<% = test %>

</b>

 

<TABLE border = 0 width="100%">

<tr>

<TD VAlign=top width="30%"><b><font face="Verdana" size="1">Name</font></b></TD>

<TD VAlign=top width="20%"><b><font face="Verdana" size="1">Phone Number</font></b></TD>

<TD VAlign=top width="20%"><b><font face="Verdana" size="1">Mobile Number</font></b></TD>

<TD VAlign=top width="20%"><b><font face="Verdana" size="1">Position</font></b></TD>

</tr>

 

<font face="Verdana" size="1">

 

<%

Do While Not adoRS.EOF

%>

<tr>

<%

mailaddress=""

mobile=""

telno=""

faxno=""

mobileshort=""

trueid=""

away2=""

honorary=""

department=""

misc=""

 

department=departmentvalue(adoRS.Fields("main_department_recID").Value)

mailaddress=value(adoRS.Fields("udf9_recID").Value)

mobile= value(adoRS.Fields("udf8_recID").Value)

faxno=value(adoRS.Fields("udf4_recID").Value)

mobileshort=value(adoRS.Fields("udf2_recID").Value)

misc=value(adoRS.Fields("udf6_recID").Value)

trueid=extensionvalue(adoRS.Fields("recID").Value)

 

 

Set adoRS2 = Server.CreateObject("ADODB.RecordSet")

strSQL2 = "SELECT reason_code FROM diversion WHERE start_time < '"& Now() & "' AND end_time > '" & Now() & "' AND is_diverted_recID = " & trueid

adoRS2.Open strSQL2, adoDB

away2=adoRS2.Fields("reason_code").Value

if away2 <> "" then

if away2 = "0" then away2 = "(LUNCH)"

if away2 = "1" then away2 = "(BUSY)"

if away2 = "2" then away2 = "(ABSENT)"

if away2 = "3" then away2 = "(MEETING)"

if away2 = "4" then away2 = "(TRAVEL)"

if away2 = "5" then away2 = "(COURSE)"

if away2 = "6" then away2 = "(VACATION)"

if away2 = "7" then away2 = "(DAY)"

if away2 = "8" then away2 = "(OUT-DAY)"

if away2 = "9" then away2 = "(ILL)"

 

else

end if

 

adors2.close

 

if mobileshort <> "" then mobile = mobile & "(" & mobileshort & ")"

if mobile <> "" then

if lcase(left(mobile,6))="privat" then

mobile = ""

else

end if

else

 

end if

telnr=adoRS.Fields("primary_extension").Value

if left(telnr,2)="90" then telnr= "+46 (0)40-40" & telnr

if left(telnr,2)="91" then telnr= "+46 (0)40-40" & telnr

if left(telnr,2)="92" then telnr= "+46 (0)40-40" & telnr

if left(telnr,2)="68" then telnr= "+46 (0)40-40" & telnr

if left(telnr,2)="22" then telnr= "+46 (0)278-64" & telnr

 

titleinfo=""

titleinfo= titleinfo & "First Name :" & adoRS.Fields("first_name").Value & chr(13)

titleinfo= titleinfo & "Last Name :" & adoRS.Fields("last_name").Value & chr(13)

if telnr <> "" then titleinfo= titleinfo & "Phone Number :" & telnr & chr(13)

if mobile <>"" THEN titleinfo= titleinfo & "Mobile Number :" & mobile & chr(13)

if away2 <> "" then titleinfo= titleinfo & "Away :" & away2 & chr(13)

if faxno <> "" then titleinfo= titleinfo & "Fax number :" & faxno & chr(13)

if mailaddress <> "" then titleinfo= titleinfo & "Mail :" & mailaddress & chr(13)

if honorary <> "" then titleinfo= titleinfo & "Position :" & honorary & chr(13)

if department <> "" then titleinfo= titleinfo & "Department :" & department & chr(13)

if misc <> "" then titleinfo= titleinfo & "Comment :" & misc & chr(13)

if mailaddress<> "" then mailaddress= " href=" & chr(34) & "mailto:" & mailaddress & chr(34)

 

titleinfo=chr(34) & titleinfo & chr(34)

 

%>

 

</font>

 

<TD VAlign=top><font face="Verdana" size="1"><a href=teleuserDetails.asp?<%=adoRS.Fields("Recid").Value%> title=<%=titleinfo%>><% = adoRS.Fields("last_name").Value%>, <% = adoRS.Fields("first_name").Value%> <% = away2%></TD>

<TD VAlign=top><font face="Verdana" size="1"><% = telnr%></font></TD>

<TD VAlign=top><font face="Verdana" size="1"><% = mobile%></font></TD>

<TD VAlign=top><font face="Verdana" size="1"><% = adoRS.Fields("honorary").Value%></font></TD>

 

</tr>

 

<font face="Verdana" size="1">

<%

AdoRs.MoveNext

Loop

%>

 

</TABLE>

</BODY>

</HTML>

 

[inlägget ändrat 2005-04-21 13:55:24 av Merkier]

[inlägget ändrat 2005-04-21 13:57:25 av Merkier]

Link to comment
Share on other sites

Hej!

 

Ligger databasen på SQL Server?

 

strConnection = "Driver={SQL Server}; Server=****; Database=****; UID=****; PWD=****"

 

... i så fall kan du prova ...

 

strSQL = "SELECT * FROM subscriber WHERE last_name LIKE '" & test & "%' order by last_name Collate SQL_SwedishStd_Pref_Cp1_CI_AS"

 

 

/PJ

 

Link to comment
Share on other sites

Det är ett project jag ska fixa till o vad jag vet så ligger den i en acces data bas. I vilket fal som helst så funkar detta.

 

Många tack, detta har jag letat efter länge ;P

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...