Am I doing anything wrong?

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Am I doing anything wrong?

    Could 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 requesting
    the policies again by the usual method to see if they have
    been requested by another user and have been placed in the
    filing tray.<p>Total files:"& CancelReq
    Response.write "<P><Div Align='Center'><a
    href='viewBulk.asp'><IMG src='../Images/View.png'
    border=0></a></Div>"
    else
    Response.redirect "../view.asp"
    end if%>
    </TD>


    Croney69 Guest

  2. Similar Questions and Discussions

    1. something wrong..
      I want to integrate following php-file into my Flash-movie, but something still does not work. The Php-file is like that: Online it looks like...
    2. What am I doing wrong?
      > rs.Source="SELECT id From User Where upper I asked this before... Try sql = "SELECT id FROM user WHERE UPPER(cLoginID) = '" & vUserID &...
    3. What is wrong?
      Take a look at your Stored Procedure. It takes a wide variety of data types. But in your code, you use an overloaded version of the Add() method of...
    4. What am I doing wrong???!?!
      I have a simple form that based on the the two inputs, ExAD_Tracking and ExAD_DateEntered, will query the database and display the records...
    5. What am I doing wrong
      I am trying to fade in an image over time, however the image keeps blinking, it fades in all the time. Below is my script. on exitFrame me go to...
  3. #2

    Default Re: Am I doing anything wrong?

    > rs.Source="SELECT id From User Where upper
    > (cLogInID)='"& vUserID &"'"
    > rs.Open, DataConn
    How about

    set rs = DataConn.execute("SELECT ... ")
    > ' GET THE LAST RECORD ID NUMBER
    Why?
    > maxid=maxid+1 ' Next record number
    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.

    [url]http://www.aspfaq.com/2174[/url]


    Aaron Bertrand [MVP] Guest

  4. #3

    Default Re: Am I doing anything wrong?

    >-----Original Message-----
    >> rs.Source="SELECT id From User Where upper
    >> (cLogInID)='"& vUserID &"'"
    >> rs.Open, DataConn
    >
    >How about
    >
    >set rs = DataConn.execute("SELECT ... ")
    >
    >> ' GET THE LAST RECORD ID NUMBER
    >
    >Why?
    >
    >> maxid=maxid+1 ' Next record number
    >
    >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.
    >
    >[url]http://www.aspfaq.com/2174[/url]
    >
    >
    >.
    >
    I am using DBF to store my data which dose not have
    autounmber.

    Thanks of the help
    Croney69 Guest

  5. #4

    Default Re: Am I doing anything wrong?

    >-----Original Message-----
    >Croney69 wrote:
    >
    >> Could you advise if I am doing anything wrong?
    >>
    >> Page: bdConnect.asp
    >> ...
    >
    >how about telling us what your problem is instead of
    >dumping all your code here.
    >
    >
    >--
    >rgndrp
    >.
    >
    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?
    Croney69 Guest

  6. #5

    Default Re: Am I doing anything wrong?

    > 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?


    Aaron Bertrand - MVP Guest

  7. #6

    Default Re: Am I doing anything wrong?

    >-----Original Message-----
    >> 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?
    >
    >
    >.
    >
    The site will be interfacing with a front office system
    design in Visual Fox. I was using Access mdb before. :(
    Croney69 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139