Hi
Can anyone help me with this?
The page i'm working on allows me to amend the CentreName field in the DB from the CentreName field in a form. Or it allows me to check wether the CentreName is duplicated and then redirects the user to another page to let them know that it is a duplicate.
But can't figure out how to be able to leave the CentreName field alone and alter another filed within that record say 'Address' Without the user being redirected to the page that tells them this is a duplicate, because the CentreName field has stayed the same??
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- #include file = "../includes/ADOVBS.INC" -->
<!-- #include file = "../includes/LOGINNOW.ASP" -->
<!--#include file="../includes/connection.asp" -->
<%
Dim Conn
Dim RS
Dim SQL
Dim searchTerm
'create connection object
Set Conn=Server.CreateObject("ADODB.Connection"
Conn.Open Openvar
'Get record EmployeeID from QueryString
searchTerm = Request.QueryString("CentreName"
'set and assign structured query statement to variable
SQL="SELECT * FROM Centre WHERE Centre.CentreName LIKE '%" &searchTerm& "%' "
'create recordset object
Set RS=Server.CreateObject("ADODB.RecordSet"
'opens the table to view all records and open and lock modes
RS.Open SQL, Conn, 3,3
Thisday = CStr(Date) ' Get todays date.
'This will test if the Centre field is left blank
If Request.Form("CentreName"
= "" Then
Response.Redirect "duplicate_centredept.asp"
Else
'This will test if the Centre field entered is duplicated data in Centre table
strCentreSQL="SELECT CentreName FROM Centre WHERE CentreName = '" & Request.Form("CentreName"
& "'"
Set rsCentre = conn.Execute(strCentreSQL)
If rsCentre.EOF then
%>
<%
RS ("CentreName"
=Request.Form("CentreName"
RS ("Address"
=Request.Form("Address"
RS ("City"
=Request.Form("City"
RS ("Postcode"
=Request.Form("Postcode"
RS ("TelNo"
=Request.Form("TelNo"
RS ("FaxNo"
=Request.Form("FaxNo"
RS.Update
%>
<table>
<tr>
<td class="dataHeader">Centre Name</td>
<td class="dataHeader">Address</td>
<td class="dataHeader">City</td>
<td class="dataHeader">Postcode</td>
<td class="dataHeader">Tel No</td>
<td class="dataHeader">Fax No</td>
</tr>
<tr>
<td class="dataContent"><%=RS("CentreName"
%></td>
<td class="dataContent"><%=RS("Address"
%></td>
<td class="dataContent"><%=RS("City"
%></td>
<td class="dataContent"><%=RS("Postcode"
%></td>
<td class="dataContent"><%=RS("TelNo"
%></td>
<td class="dataContent"><%=RS("FaxNo"
%></td>
</tr>
</table>
<%
Else
Response.Redirect "duplicate_centredept.asp"
End If 'rsCentre.EOF
End If 'Request.Form("Centre"
= ""
%>
Thanks for anybody's help with this.
Can anyone help me with this?
The page i'm working on allows me to amend the CentreName field in the DB from the CentreName field in a form. Or it allows me to check wether the CentreName is duplicated and then redirects the user to another page to let them know that it is a duplicate.
But can't figure out how to be able to leave the CentreName field alone and alter another filed within that record say 'Address' Without the user being redirected to the page that tells them this is a duplicate, because the CentreName field has stayed the same??
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- #include file = "../includes/ADOVBS.INC" -->
<!-- #include file = "../includes/LOGINNOW.ASP" -->
<!--#include file="../includes/connection.asp" -->
<%
Dim Conn
Dim RS
Dim SQL
Dim searchTerm
'create connection object
Set Conn=Server.CreateObject("ADODB.Connection"
Conn.Open Openvar
'Get record EmployeeID from QueryString
searchTerm = Request.QueryString("CentreName"
'set and assign structured query statement to variable
SQL="SELECT * FROM Centre WHERE Centre.CentreName LIKE '%" &searchTerm& "%' "
'create recordset object
Set RS=Server.CreateObject("ADODB.RecordSet"
'opens the table to view all records and open and lock modes
RS.Open SQL, Conn, 3,3
Thisday = CStr(Date) ' Get todays date.
'This will test if the Centre field is left blank
If Request.Form("CentreName"
Response.Redirect "duplicate_centredept.asp"
Else
'This will test if the Centre field entered is duplicated data in Centre table
strCentreSQL="SELECT CentreName FROM Centre WHERE CentreName = '" & Request.Form("CentreName"
Set rsCentre = conn.Execute(strCentreSQL)
If rsCentre.EOF then
%>
<%
RS ("CentreName"
RS ("Address"
RS ("City"
RS ("Postcode"
RS ("TelNo"
RS ("FaxNo"
RS.Update
%>
<table>
<tr>
<td class="dataHeader">Centre Name</td>
<td class="dataHeader">Address</td>
<td class="dataHeader">City</td>
<td class="dataHeader">Postcode</td>
<td class="dataHeader">Tel No</td>
<td class="dataHeader">Fax No</td>
</tr>
<tr>
<td class="dataContent"><%=RS("CentreName"
<td class="dataContent"><%=RS("Address"
<td class="dataContent"><%=RS("City"
<td class="dataContent"><%=RS("Postcode"
<td class="dataContent"><%=RS("TelNo"
<td class="dataContent"><%=RS("FaxNo"
</tr>
</table>
<%
Else
Response.Redirect "duplicate_centredept.asp"
End If 'rsCentre.EOF
End If 'Request.Form("Centre"
%>
Thanks for anybody's help with this.