Am I doing anything wrong?

Am I doing anything wrong?

Post by Croney6 » Fri, 04 Jul 2003 20:52:22


ould you advise if I am doing anything wrong?

Page: bdConnect.asp

<%
Set DataConn = Server.CreateObject("ADODB.Connection")
'DataConn.ConnectionTimeout = 15
'DataConn.CommandTimeout = 30
'DataConn.mode = 16
DataConn.provider="MSDASQL.1"
DataConn.Open "Driver={Microsoft Visual FoxPro Driver};" &
_
"SourceType=DBC;" & _

"SourceDB=c:\inetpub\wwwroot\mydatabase\mydatabase.
dbc;" & _
"Exclusive=No; Null=No"

%>

Page: MyPage.asp

<!--#include file="bdConnect.asp" --> 'Top of the page
This script is in the body in a table

<TD>
<%
set rs = server.CreateObject("ADODB.RecordSet")

' GET USER ID
vUserID = Replace(Request.ServerVariables
("logon_USER"),"UNITED\","")
vUserID = ucase(vUserID)

' GET USER ID NUMBER FROM USER
TABLE
rs.Source="SELECT id From User Where upper
(cLogInID)='"& vUserID &"'"
rs.Open, DataConn
vUserID=rs("id")
rs.Close

' GET THE LAST RECORD ID NUMBER
rs.source="SELECT max(id) as MaxID From
filerequests"
rs.Open, DataConn
maxid=rs("maxid")
rs.Close

' GET INFORMATIO FOR THE USER OUT OF THE
FILEREQUEST TABLE AND ADD EACH TO FILEREQUEST
rs.Source="SELECT FileRequestBulk.id,
FileRequestBulk.cPolicy, PolicyData.cName,
PolicyData.cOldPolicy FROM FileRequestBulk LEFT JOIN
PolicyData on FileRequestBulk.cPolicy=PolicyData.cPolicy
Where iUser="& vUserID
rs.open, DataConn
C=0

' CREATE ARRAY
do until rs.EOF
c=c+1
Client=Client &""& rs("cPolicy")&""& rs("cName")
&""& rs("cOldPolicy")
rs.MoveNext
Loop

rs.Close

'DO LOOP TO ADD REQUEST TO FILEREQUEST
TABLE (ONLY POLICIES THAT HAVE NOT BEEN ALREADY REQUESTED)
I=0
CancelReq=0
do until I=C or I>25
I=I+1
maxid=maxid+1 ' Next record number

' Break down array
P=left(Client,12) ' Policy number
N=mid(Client,13,16) ' Name of client
OP=mid(Client,29, 12) ' Old Policy number

Client=mid(Client,41) ' Remove this policy data
from the array

' CHECK TO SEE IF THE POLICY IS
ALERADY OUT AND ADD POLICY IF NOT
rs.source="SELECT asc(dtoc(tReturnDat)) as RTD,
id, cUserID, tRequestDa, tTimeStamp, cClient, cPolClmNo,
CPolOld, iPriority From FileRequests Where cpolclmno ='"&
P &"' and asc(dtoc(tFileDate))=32"
rs.Open, DataConn,2,3
if rs.EOF then
'ADD REQUEST TO FILEREQUEST
rs.AddNew
rs("id")=maxid
rs("cUserID")=vUserID
rs("tRequestDa")=now()
rs("tTimeStamp")=now()
rs("cClient")=N
rs("cPolClmNo")=P
rs("cPolOld")=OP
rs("iPriority")="0"
rs.Update
rs.Close

'INSERT INTO
FILEREQUESTCHECKER FOR FILING ROOM
rs.Source="INSERT INTO
FileRequestChecker (cPolicy, dRequested, id) VALUES ('"& P
&"', {"& date() &"}, "& maxid &")"
rs.Open, DataConn

'DELETE DATA OUT
OF FILEREQUESTBULK
Set rs = nothing
set rs = server.CreateObject
("ADODB.RecordSet")
rs.Source="DELETE from
FileRequestBulk Where cPolicy='"& P &"' and iUser="&
vUserID
rs.Open,dataConn
else
RTD=rs("RTD")
ID=rs("id")
rs.Close
' File was already
in use
rs.Source="UPDATE FileRequestBulk
Set iReason= "& RTD &" Where id="& id
rs.Open,dataConn
CancelReq=CancelReq+1

end if

Loop

Set rs = nothing
DataConn.Close
set DataConn=nothing

if CancelReq >0 then
response.write "Some of the policies that you have
requested have been canceled and remain in your bulk
folder as they are already in use. You can try requestin
 
 
 

Am I doing anything wrong?

Post by Aaron Bert » Fri, 04 Jul 2003 21:06:35

> rs.Source="SELECT id From User Where upper

How about

set rs = DataConn.execute("SELECT ... ")


Why?


You don't know this for sure, if id is an autonumber. Someone else could
run an insert while this script is running. Instead of trying to predict
the next value, get it when you insert.

http://www.yqcomputer.com/

 
 
 

Am I doing anything wrong?

Post by Croney6 » Sat, 05 Jul 2003 00:05:01


Someone else could
trying to predict

I am using DBF to store my data which dose not have
autounmber.

Thanks of the help
 
 
 

Am I doing anything wrong?

Post by Croney6 » Sat, 05 Jul 2003 00:11:05


I have requested help on my problem and will post it below.

I am using Windows2000 server, IIS5 and ASP to produce and
Intranet for the employees with applications to help with
their day-to-day work. I have recently redesign to site
and move away from the global.asa and have also switch
from mdb to dbf to link back into our front office
program.

I am now encountering a problem where users are unable to
view any pages that access the database. (ASP pages) This
dose not affects html or ASP pages that do not connect to
the database.

This problem occurs after one day. Restarting the IIS will
resolve the problem for a time then the only way it to
restart the server.

I have notice that by removing this page it seems to stop
the problem. But I need to know what the problem is so
that this error would not occur again.

I was advise to use IISState but I could not see any thing
wrong and ask for help. Got none! I was also told to use
AdPlus, same problem with the reports. No help.

Can you haelp?
 
 
 

Am I doing anything wrong?

Post by Aaron Bert » Sat, 05 Jul 2003 00:45:31

> I am using DBF to store my data which dose not have autounmber.

Maybe you should choose a database that supports the features you need?
 
 
 

Am I doing anything wrong?

Post by Croney6 » Sat, 05 Jul 2003 01:01:48


autounmber.
features you need?
The site will be interfacing with a front office system
design in Visual Fox. I was using Access mdb before. :(