Problems!!!

S

Sorin B

Hi !!!
I'm using a database ms access and I have a problem. I need
to make something like this:

First I made a search form that's searching clients and
shows me a checkbox, the name of the client and total debts
.... and now comes the problem I need to display all checked
clients into another table with all their details.
Something like master-child page, but only some clients,
not all of them.

How do I make this ?

Please help me

Thanks
 
M

MD WebsUnlimited.com

Hi Sorin,

You'll need to write a custom ASP page to handle the database queries and
display of each of the checked clients.
 
S

Sorin B

Can you give me an example of a such code?
-----Original Message-----
Hi Sorin,

You'll need to write a custom ASP page to handle the database queries and
display of each of the checked clients.

--
Mike -- FrontPage MVP '97 - '02
http://www.websunlimited.com
Save 20% using the Promotion code FPNEWS now until Dec 31.
----------------------------------------------------------------------------
--------------------
If you think I'm doing a good job, let MS know at (e-mail address removed)




.
 
M

MD WebsUnlimited.com

A very simple example that assumes that the checkboxes have a unique value
that's assoicated them with a db record. The unique thing about checkboxes
is that only those that are checked are sent back to the server. I've also
assumed that the checkboxes have the same name and thus form a collection.

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 9</title>
</head>

<body>

<%

if request.servervariables("REQUEST_METHOD") = "POST" then
' iterate the check boxes
'
for each oCheck in request.form("C1")
response.write oCheck & "<br>"
'
' Build the SQL Select string
'
sSelect ="Select * from mytable where ID = '" & oCheck & "';"
'open the record
set oRS = cn.execute(sSelect)
if Not oRS.Eof then
'
' write out the details
'
response.write oRS("Name") & " " & oRS("Address")
else
'
' write out an exception message
'
response.write "Unable to find record for " & oCheck
end if
oRS.close
next
else
%>
<form method="POST" action="iterateCheckboxes.asp">
<p><input type="checkbox" name="C1" value="Item1">Item 1</p>
<p><input type="checkbox" name="C1" value="Item2"> Item 2</p>
<p><input type="checkbox" name="C1" value="Item3"> Item 3</p>
<p><input type="checkbox" name="C1" value="Item4"> Item 4</p>
<p><input type="checkbox" name="C1" value="Item5"> Item 5</p>
<p><input type="submit" value="Submit" name="B1"><input type="reset"
value="Reset" name="B2"></p>
</form>
<% End if %>
</body>

</html>




Can you give me an example of a such code?
 
J

Jon Spivey

or building the sql like this will allow 1 or several clients to be
displayed
if the client has a numeric id, eg
<input type="checkbox" name="client" value="1">jones ltd
<input type="checkbox" name="client" value="2">smith ltd
<%
sql = "select * from customers where clientid in(" & request.form("client")
& ")"
'sql will be something like
'select * from customers where clientid in(1,2)
%>
or if the clientid is text sling some quotes around, eg
<input type="checkbox" name="client" value="jones">jones ltd
<input type="checkbox" name="client" value="smith">smith ltd
<%
sql = "select * from customers where clientid in('" &
replace(request.form("client"), ", ", "','") & "')"
'sql will be something like
'select * from customers where clientid in('jones','smith')
%>

Jon
Microsoft MVP - FP
 
M

MD WebsUnlimited.com

Jon,

Do you know which would be more efficient? It logically seems to me and
something sticks in my head that I had read that the "in" verb was extremely
expensive to utilize. This also would assuming that the selection field is
indexed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top