|
 |
sql_language thread: RE: Looping through querystring
Message #1 by "Sheeks, S D (David) " <SDSheeks@M...> on Tue, 27 Mar 2001 11:52:17 -0500
|
|
You can do this:
strConn =3D "driver=3D{SQL
SERVER};server=3Dsqlserver;database=3Ddatabase;
UID=3Duser; password=3Dpassword"
Application("ConnectionString") =3D strConn
Dim rsorg,validorgs
Set conn=3D Server.CreateObject("ADODB.Connection")
conn.open Application("ConnectionString")
Set rsorg =3D Server.CreateObject("ADODB.RecordSet")
sql =3D "SELECT DISTINCT org_code FROM common..organization WHERE
org_code_term_date =3D 0"
rsorg.Open sql,conn,0,1
Do until rsorg.EOF
validorgs=3Dvalidorgs & rsorg.Fields("org_code") & ","
rsorg.MoveNext : Loop
rsorg.close
%>
<script language=3D"VBScript">
Function OrgCode_onblur
isvalid =3D OrgCodeReturn
If Not isvalid Then
msgbox(document.fcustomer.OrgCode.value &" " & "Is Not A Valid Org
Code")
document.fcustomer.orgcode.focus
document.fcustomer.OrgCode.value=3D""
End If
End Function
validorgs=3D"<%=3Dvalidorgs%>"
Arrayorgs=3DSplit(validorgs,",")
Function OrgCodeReturn
For x=3D0 to Ubound(Arrayorgs)
If document.fcustomer.OrgCode.value =3D Arrayorgs(x) Then
orgcodereturn=3DTrue
Exit Function
End If
Next
orgcodereturn=3DFalse
End Function
</script>
-----Original Message-----
From: Polsky, Eva [mailto:EPolsky@s...]
Sent: Tuesday, March 27, 2001 11:17 AM
To: sql language
Subject: [sql_language] RE: loop through querystring values
Hector,
may be you can use Split function and then loop thru the index of array
Eva
-----Original Message-----
From: Hector [mailto:ektorjr@h...]
Sent: Tuesday, March 27, 2001 9:43 AM
To: sql language
Subject: [sql_language] loop through querystring values
Hi
My users check a number of id values in a form, and then these values
are
posted in the string. Then, i want to take all these ID values from the
string, compare them with an Access db field and display the contents of
the matched rows.
I suppose a For-Next loop would be the best for my case but i can't find
the right way to this...
Can anybody help???
|
|
 |