blakeph
07-24-2005, 04:06 AM
hi guys! i have a web application that will query the users from our Active Directory, my connection and query strings look like this:
var users = [
<%
Dim con,rs,Com,search_name
Set con = Server.CreateObject("ADODB.Connection")
con.provider ="ADsDSOObject"
Con.Properties("User ID") = "kfmc\"&session("uname")
Con.Properties("Password") = session("pwd")
con.open "Active Directory Provider"
Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = con
Com.CommandText ="select name, sAMAccountname, mail, pager from 'LDAP://10.20.4.20/dc=kfmc,dc=med' WHERE objectCategory='person' and name = '*"+search_name+"*' and ( pager = '3*' or pager = '2*') ORDER BY name"
Set rs = Com.Execute
%>
<%
Do While Not rs.EOF
%>
["<%=rs.Fields("pager")%>", "<% response.write rs("Name")%>", "<% response.write rs("mail")%>"],
<%
rs.MoveNext
Loop
rs.Close
%>
];
and when this query is generated, it will look like this:
["3209", "Abdalla E. Khalil", "akhalil@ourdomain.com"],
["3053", "Abdelsalam A. Ismail", "aismail@ourdomain.com"],
["3228", "Abdul B. Cady", "acady@ourdomain.com"],
["2772", "Abdulaziz S. Aljaser", "aljaser@ourdomain.com"],
is there any way to trim the last comma (,) in the array? because if there is, my application doesn't work. any help would be appreciated. thanks!
var users = [
<%
Dim con,rs,Com,search_name
Set con = Server.CreateObject("ADODB.Connection")
con.provider ="ADsDSOObject"
Con.Properties("User ID") = "kfmc\"&session("uname")
Con.Properties("Password") = session("pwd")
con.open "Active Directory Provider"
Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = con
Com.CommandText ="select name, sAMAccountname, mail, pager from 'LDAP://10.20.4.20/dc=kfmc,dc=med' WHERE objectCategory='person' and name = '*"+search_name+"*' and ( pager = '3*' or pager = '2*') ORDER BY name"
Set rs = Com.Execute
%>
<%
Do While Not rs.EOF
%>
["<%=rs.Fields("pager")%>", "<% response.write rs("Name")%>", "<% response.write rs("mail")%>"],
<%
rs.MoveNext
Loop
rs.Close
%>
];
and when this query is generated, it will look like this:
["3209", "Abdalla E. Khalil", "akhalil@ourdomain.com"],
["3053", "Abdelsalam A. Ismail", "aismail@ourdomain.com"],
["3228", "Abdul B. Cady", "acady@ourdomain.com"],
["2772", "Abdulaziz S. Aljaser", "aljaser@ourdomain.com"],
is there any way to trim the last comma (,) in the array? because if there is, my application doesn't work. any help would be appreciated. thanks!