newbie - updatable query in asp

K

Krechting

Hi folks,

I'm new in ASP so I need some help on a updatable query.
I have an access db with the table SID_Master_Archief.

From this table I would like to run a query showing six fields.
The doc_date(date), doc_link(hyperlink), regio1(boolean),
regio2(boolean), regio3(boolean),regio4(boolean).

The boolean fields have to be checked by the user.
So I need a asp form with a grid showing these records and have the
users click on one of the regio fields (I guess with a checkbox) to
check or uncheck and then confirm with a button somewhere on the form
to send the update to the server.

Anyone how I should do this?

Regards
Marco
The Netherlands
 
?

????

test.htm
<form method=post name=theForm action=test.asp>
<input type=checkbox name=check1 value=1>
<input type=checkbox name=check2 value=1>
<input type=checkbox name=check3 value=1>
<input type=submit >
</form>

test.asp

check1 = request.form(check1)
check2 = request.form(check2)
check3 = request.form(check3)

if check1 = "" then
check1 = 0
end if
..
..
......
 
M

Marco Krechting

Thanks for this quick reply.
Can I use these checkboxes also to display my query?
I have the four boolean fields which are normally always set to false.
When the user clicks one of the boxes and sent it to the server the db gets
updated.

Marco
 
D

ddongdog\(Jinhyung Lee\)

in my case

use onclick method. and checkClick();
<script language=javascript>
function checkClick()
{
document.theForm.submit() ;
}
 
M

Marco Krechting

Ok,

But how do I connect the boolean fields to the checkboxes on the form?

Marco
 
D

ddongdog\(Jinhyung Lee\)

do you mean this??
<script language=javascript>
function checkClick()
{
document.theForm.submit() ;
}
dim srtSQL, Dbcon

SET Dbcon = Server.Create.Object("ADODB.Connection")
Dbcon.Open strConnect

strSQL = "UPDATE table_name SET checkField1 = check1,checkField2 = check3
WHERE idx = intIdx ( you have to make "WHERE .....")
 
M

Marco Krechting

I do not really understand what's happening here.
Let me draw you what it should do.

A user opens a region.asp form and gets to see this:

ID Doc_date Doc_link John Peter Tom Ben

1 12-7-2004 test.doc x x
2 12-7-2004 test2.ppt x
x
3 13-7-2004 test3.pdf x
4 14-7-2004 test4.doc x
x
etc.....

Whereas the "x's" should be checkboxes which I can check or uncheck.
They are representing the fields John, Peter, Tom and Ben.
This means that the user can click in the column of his name to mark the
files he has read.
And then maybe a button at the bottom of the form saying "Update Records".
When clicking this button the update will be send to the db.

HTH

Marco
 

¶Ë°­¾ÆÁö

can we see region.asp code??


Marco Krechting said:
I do not really understand what's happening here.
Let me draw you what it should do.

A user opens a region.asp form and gets to see this:

ID Doc_date Doc_link John Peter Tom Ben

1 12-7-2004 test.doc x x
2 12-7-2004 test2.ppt x
x
3 13-7-2004 test3.pdf x
4 14-7-2004 test4.doc x
x
etc.....

Whereas the "x's" should be checkboxes which I can check or uncheck.
They are representing the fields John, Peter, Tom and Ben.
This means that the user can click in the column of his name to mark the
files he has read.
And then maybe a button at the bottom of the form saying "Update Records".
When clicking this button the update will be send to the db.

HTH

Marco
 
M

Marco Krechting

Forgive my guys it's not nicely programmed but I'm starting.
The support page is opening the conn and steering the paging process.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- #include file="pages_support_region1.asp" -->
<%if not session("AdminOk")="true" then response.Redirect "login.asp" %>
<html><head><style type="text/css">
td{
font-family: verdana;
font-style: normal;
font-weight: bold;
font-size: .6em;
}
</style></head><body>
<script language=javascript>
function checkClick()
{
document.theForm.submit() ;
}
</script>
<form name="form1" method="post" action="search_names_results.asp">
<%

Dim rst, strSQL
set rst = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM SID_Master_Archief WHERE
((([SID_Master_Archief]![Regio1])=True)) ORDER BY
SID_Master_Archief.Document_Datum DESC"
rst.Open strSQL, connect, 3, 1, 1

Dim IntPageSize, PageIndex, TotalPages, TotalRecords
Dim RecordCount, RecordNumber

IntPageSize = 15
PageIndex = Request("PageIndex")
'If pageIndex is empty, set it to one.
if PageIndex = "" then PageIndex = 1

RecordCount = rst.RecordCount
RecordNumber = (PageIndex * IntPageSize) - (IntPageSize)

rst.PageSize = intPageSize ' Set the number of records per page
rst.AbsolutePage = PageIndex 'Define what page number on which the current
record resides.

TotalPages = rst.PageCount

dim intPrev, intNext
intPrev = PageIndex - 1
intNext = PageIndex + 1 'same as rst.AbsolutePage

response.write("<img src=banner.gif alt='ADMIS Webversion 1.0.0.'
border=0>")
response.write("<p>")
response.write("<font face= trebuchet>")
Response.write("<font size = 4 color=green>")
Response.write "ADMIS Region 1 Total Archive"
Response.write("</font>")

'Build table header
With Response
.write "<table border=1 cellpadding=5 cellspacing=0>"
.write "<tr bgcolor=gainsboro>"
.write "<td>ID</td>"
.write "<td>Publishing Date</td>"
.write "<td>Document Link</td>"
.write "<td>Stensbol</td>"
.write "<td>Wilson</td>"
.write "<td>Eisert</td>"
.write "<td>Schaekel</td>"
.write "</tr>"
end with

Dim Count 'We'll use this to limit the number of records displayed on a page
DIM strLocation, euroDate
Dim sLink, sHyperlink
sLink = "N:\CG2\Archief\"
dim intRowColor
Count = 1
do while NOT rst.EOF AND Count <= IntPageSize
With Response
.Write"<tr>"
if intRowColor = 0 Then
.Write "<TR align=left colspan=9 bgcolor=""lightblue"">"
intRowColor = 1
Else
.Write "<TR align=left colspan=9 bgcolor=""white"">"
intRowColor = 0
End if
.Write "<td>" & RecordNumber + Count & "</td>"

euroDate = Right("0" & Day(rst("document_datum")), 2) & "/" &
Right("0" & Month(rst("document_datum")), 2) & "/" &
Year(rst("document_datum"))
.Write "<td>" & euroDate & "</td>"

sHyperlink= sLink & Left(rst("document_link"),
Instr(rst("document_link"),"#")-1)
.Write "<td>" & "<A HREF=""" & sHyperlink & """>" &
Left(rst("document_link"), Instr(rst("document_link"),"#")-1) & "</A>" &
"</td>"
%>
<form name="form1" method="post" action="search_names_results.asp">
<%
if rst("ARR101") = "True" then 'stensbol
.Write "<td align=center><input type=checkbox name=check1 CHECKED
onclick=checkClick();></td>"
else
.Write "<td align=center><input type=checkbox name=check1
onclick=checkClick();></td>"
end if
if rst("ARR103") = "True" then 'wilson
.Write "<td align=center><input type=checkbox name=check2 CHECKED
onclick=checkClick();></td>"
else
.Write "<td align=center><input type=checkbox name=check2
onclick=checkClick();></td>"
end if
if rst("ARR104") = "True" then 'eisert
.Write "<td align=center><input type=checkbox name=check3 CHECKED
onclick=checkClick();></td>"
else
.Write "<td align=center><input type=checkbox name=check3
onclick=checkClick();></td>"
end if
if rst("ARR105") = "True" then 'schaekel
.Write "<td align=center><input type=checkbox name=check4 CHECKED
onclick=checkClick();></td>"
else
.Write "<td align=center><input type=checkbox name=check4
onclick=checkClick();></td>"
end if
%>
<!-- <td align=center><input type=checkbox name=check1 CHECKED
value=<%=x1%> onclick=checkClick();></td>
<td align=center><input type=checkbox name=check2 CHECKED value=<%=x2%>
onclick=checkClick();></td>
<td align=center><input type=checkbox name=check3 CHECKED value=<%=x3%>
onclick=checkClick();></td>
<td align=center><input type=checkbox name=check4 CHECKED value=<%=x4%>
onclick=checkClick();></td> -->
<%
.write "</tr>"
End with
count = count + 1
rst.MoveNext
loop
Response.Write "<tr><td align=center colspan=9 bgcolor=gainsboro>"
call BuildNav2 (intPrev,IntNext,TotalPages)
response.write "</td></tr></table>"
rst.close
%>
<table align=centert><input type="submit" name="Submit"
value="Update"></tr></table>
</body></html>


Marco
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top