3 days without sleep, posting here as a last resort

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

  1. #1

    Default 3 days without sleep, posting here as a last resort

    Hi everyone,

    I'm developing a web application(VideoRental) using ASP with Access
    as the database. My machine runs Windows XP. In my codes, I'm using a
    DSN connection to the database.

    Initially, whenever I click on the page that's supposed to trigger
    another page containing the ASP codes to connect to the database, a
    download window appears and asks me whether do I want to download that
    page!

    I however managed to solve that. But when I tried to connect to the
    database using a DSN-less connection, the problem appeared again.

    The second type of problem that I encountered is the insertion of
    blank rows into my database. Whenever I try to add new records into my
    database(via a DSN connection), the data from my form is not passed
    into the database. Instead, blank rows are inserted into my database.

    The values that appear on my browser's address bar are
    [url]http://localhost/videomx2/db/addvideo2.asp?T1=&T2=&T3=&T4=&T5=&T6=&T7=&T8=&B4=S ubmit[/url].

    T1 to T8 are the names of the textbox that contain the values
    that's to be passed to the database. B4 is the name of the submit
    button.

    I would really appreciate any help that I can get. Below are my codes.

    ************************************************** *****************************

    <%

    Set conn = Server.CreateObject("ADODB.Connection")

    Source=C:\Inetpub\wwwroot\VideoMX2\db\VideoMX.mdb; "
    conn.provider = "microsoft.jet.OLEDB.4.0"

    conn.open(server.mappath("VideoMX.mdb"))

    Set rs = Server.CreateObject("ADODB.Recordset")
    sqlString="Select * From Video"

    rs.Open sqlString, conn, cursor, 2

    rs.addnew

    rs.Fields("VideoCode")=request.form("T1")
    rs.Fields("VideoTitle")=request.form("T2")
    rs.Fields("DateReleased")=request.form("T3")
    rs.Fields("Sypnosis")=request.form("T4")
    rs.Fields("Genre")=request.form("T5")
    rs.Fields("RunningTime")=request.form("T6")

    rs.update

    rs.close

    Response.Write request.form " updated!"

    conn.close

    %>
    - DSN connection
    __________________________________________________ _____________________________

    <%

    VideoCode=Request.form("VideoCode")
    VideoTitle=Request.form("VideoTitle")
    DateReleased=Request.form("DateReleased")
    Synopsis=Request.form("Synopsis")
    Genre=Request.form("Genre")
    RunningTime=Request.form("RunningTime")
    Image=Request.form("Image")


    set Conn=Server.CreateObject("ADODB.Connection")
    Conn.Open "DSN=VideoMX"


    set userSet=CreateObject("ADODB.Recordset")
    userSet.ActiveConnection = Conn
    sqlText="Select * FROM Video WHERE VideoCode='"&VideoCode&"'"
    userSet.Open sqlText
    if userSet.EOF then
    theSQL="insert into Video"
    theSQL=theSQL & "(VideoCode,VideoTitle,DateReleased,Synopsis,Genre ,RunningTime,Image)"
    theSQL=theSQL & "values('"&VideoCode&"','"&VideoTitle&"','"&DateRe leased&"','"&Synopsis&"','"&Genre&"','"&RunningTim e&"','"&Image&"')"

    set userSet=Conn.Execute(theSQL)
    Response.Redirect("/mx/updtviddet.asp")
    Conn.close
    End if
    %>
    - DSN-less connection
    TsiuWeng Ng Guest

  2. Similar Questions and Discussions

    1. Resort datagrid after item is added
      I have a datagrid that you can add items to. When you add an item to a certain instance of the grid I want it to sort by the instance you are...
    2. #39560 [NEW]: Inconsistent behaviour of strtotime when days > days in month
      From: php at colin dot guthr dot ie Operating system: Linux PHP version: 5.2.0 PHP Bug Type: Date/time related Bug...
    3. fallback-reboot, a new last resort in rebooting a system remotely
      Comments and suggestions are welcome, especially if there's already something like this in the free software world. Thanks for reading. This...
    4. Looking for an animation! Last resort!
      Gawd knows how long ago I seen a very amusing flash file( i think it was flash), anyway this was a cartoon type thing of an alien singing "Lovely...
    5. Sleep/timer
      Hi how do i make a frame delay for x ammount of seconds? Is there a sleep command?
  3. #2

    Default Re: 3 days without sleep, posting here as a last resort

    Well, I don't know about the downloading of your page thing unless you're
    trying to call your page by C:\inetpub\wwwroot\yourpage.asp as opposed to
    [url]http://localhost[/url], but the one thing I noticed right away, aside from the
    fact that all your "T" values have no value, is that you're using
    request.FORM when it appears your form is using method=get. With
    method=get, your values are passed in the querystring, not a form
    collection, so you have to use request.QUERYSTRING("T1").

    Ray at home

    "TsiuWeng Ng" <tsiuweng@msn.com> wrote in message
    news:731cdf4d.0312242146.182fd85e@posting.google.c om...
    > Hi everyone,
    >
    > I'm developing a web application(VideoRental) using ASP with Access
    > as the database. My machine runs Windows XP. In my codes, I'm using a
    > DSN connection to the database.
    >
    > Initially, whenever I click on the page that's supposed to trigger
    > another page containing the ASP codes to connect to the database, a
    > download window appears and asks me whether do I want to download that
    > page!
    >
    > I however managed to solve that. But when I tried to connect to the
    > database using a DSN-less connection, the problem appeared again.
    >
    > The second type of problem that I encountered is the insertion of
    > blank rows into my database. Whenever I try to add new records into my
    > database(via a DSN connection), the data from my form is not passed
    > into the database. Instead, blank rows are inserted into my database.
    >
    > The values that appear on my browser's address bar are
    >
    [url]http://localhost/videomx2/db/addvideo2.asp?T1=&T2=&T3=&T4=&T5=&T6=&T7=&T8=&B[/url]
    4=Submit.
    >
    > T1 to T8 are the names of the textbox that contain the values
    > that's to be passed to the database. B4 is the name of the submit
    > button.
    >
    > I would really appreciate any help that I can get. Below are my codes.
    >
    >
    ************************************************** **************************
    ***
    >
    > <%
    >
    > Set conn = Server.CreateObject("ADODB.Connection")
    >
    > Source=C:\Inetpub\wwwroot\VideoMX2\db\VideoMX.mdb; "
    > conn.provider = "microsoft.jet.OLEDB.4.0"
    >
    > conn.open(server.mappath("VideoMX.mdb"))
    >
    > Set rs = Server.CreateObject("ADODB.Recordset")
    > sqlString="Select * From Video"
    >
    > rs.Open sqlString, conn, cursor, 2
    >
    > rs.addnew
    >
    > rs.Fields("VideoCode")=request.form("T1")
    > rs.Fields("VideoTitle")=request.form("T2")
    > rs.Fields("DateReleased")=request.form("T3")
    > rs.Fields("Sypnosis")=request.form("T4")
    > rs.Fields("Genre")=request.form("T5")
    > rs.Fields("RunningTime")=request.form("T6")
    >
    > rs.update
    >
    > rs.close
    >
    > Response.Write request.form " updated!"
    >
    > conn.close
    >
    > %>
    > - DSN connection
    >
    __________________________________________________ __________________________
    ___
    >
    > <%
    >
    > VideoCode=Request.form("VideoCode")
    > VideoTitle=Request.form("VideoTitle")
    > DateReleased=Request.form("DateReleased")
    > Synopsis=Request.form("Synopsis")
    > Genre=Request.form("Genre")
    > RunningTime=Request.form("RunningTime")
    > Image=Request.form("Image")
    >
    >
    > set Conn=Server.CreateObject("ADODB.Connection")
    > Conn.Open "DSN=VideoMX"
    >
    >
    > set userSet=CreateObject("ADODB.Recordset")
    > userSet.ActiveConnection = Conn
    > sqlText="Select * FROM Video WHERE VideoCode='"&VideoCode&"'"
    > userSet.Open sqlText
    > if userSet.EOF then
    > theSQL="insert into Video"
    > theSQL=theSQL &
    "(VideoCode,VideoTitle,DateReleased,Synopsis,Genre ,RunningTime,Image)"
    > theSQL=theSQL &
    "values('"&VideoCode&"','"&VideoTitle&"','"&DateRe leased&"','"&Synopsis&"','
    "&Genre&"','"&RunningTime&"','"&Image&"')"
    >
    > set userSet=Conn.Execute(theSQL)
    > Response.Redirect("/mx/updtviddet.asp")
    > Conn.close
    > End if
    > %>
    > - DSN-less connection

    Ray at Guest

  4. #3

    Default Re: 3 days without sleep, posting here as a last resort


    "Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message
    news:essQhRryDHA.3208@tk2msftngp13.phx.gbl...
    > Well, I don't know about the downloading of your page thing unless you're
    > trying to call your page by C:\inetpub\wwwroot\yourpage.asp as opposed to
    > [url]http://localhost[/url], but the one thing I noticed right away, aside from the
    > fact that all your "T" values have no value, is that you're using
    > request.FORM when it appears your form is using method=get. With
    > method=get, your values are passed in the querystring, not a form
    > collection, so you have to use request.QUERYSTRING("T1").
    >
    > Ray at home
    >

    Don't you ever take time off Ray???



    Alistair Guest

  5. #4

    Default Re: 3 days without sleep, posting here as a last resort


    "Alistair" <news@*remove*alistairb.co.uk> wrote in message
    news:vumbk97ev33j9a@corp.supernews.com...
    >
    >
    > Don't you ever take time off Ray???
    >
    Heh heh. I was away from my computer for almost the entire day, today. It
    was not fun!

    Ray at home


    Ray at Guest

  6. #5

    Default Re: 3 days without sleep, posting here as a last resort

    Thanks ray,

    Its working now :) I used the get.Querystring().
    I know the following question is a little lame ... it's now adding
    records to the top of my database table, instead adding it to the
    bottom. How do I solve that?

    Thanks for the help.

    Regards,
    TsiuWeng

    "Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message news:<essQhRryDHA.3208@tk2msftngp13.phx.gbl>...
    > Well, I don't know about the downloading of your page thing unless you're
    > trying to call your page by C:\inetpub\wwwroot\yourpage.asp as opposed to
    > [url]http://localhost[/url], but the one thing I noticed right away, aside from the
    > fact that all your "T" values have no value, is that you're using
    > request.FORM when it appears your form is using method=get. With
    > method=get, your values are passed in the querystring, not a form
    > collection, so you have to use request.QUERYSTRING("T1").
    >
    > Ray at home
    >
    > "TsiuWeng Ng" <tsiuweng@msn.com> wrote in message
    > news:731cdf4d.0312242146.182fd85e@posting.google.c om...
    > > Hi everyone,
    > >
    > > I'm developing a web application(VideoRental) using ASP with Access
    > > as the database. My machine runs Windows XP. In my codes, I'm using a
    > > DSN connection to the database.
    > >
    > > Initially, whenever I click on the page that's supposed to trigger
    > > another page containing the ASP codes to connect to the database, a
    > > download window appears and asks me whether do I want to download that
    > > page!
    > >
    > > I however managed to solve that. But when I tried to connect to the
    > > database using a DSN-less connection, the problem appeared again.
    > >
    > > The second type of problem that I encountered is the insertion of
    > > blank rows into my database. Whenever I try to add new records into my
    > > database(via a DSN connection), the data from my form is not passed
    > > into the database. Instead, blank rows are inserted into my database.
    > >
    > > The values that appear on my browser's address bar are
    > >
    > [url]http://localhost/videomx2/db/addvideo2.asp?T1=&T2=&T3=&T4=&T5=&T6=&T7=&T8=&B[/url]
    > 4=Submit.
    > >
    > > T1 to T8 are the names of the textbox that contain the values
    > > that's to be passed to the database. B4 is the name of the submit
    > > button.
    > >
    > > I would really appreciate any help that I can get. Below are my codes.
    > >
    > >
    > ************************************************** **************************
    > ***
    > >
    > > <%
    > >
    > > Set conn = Server.CreateObject("ADODB.Connection")
    > >
    > > Source=C:\Inetpub\wwwroot\VideoMX2\db\VideoMX.mdb; "
    > > conn.provider = "microsoft.jet.OLEDB.4.0"
    > >
    > > conn.open(server.mappath("VideoMX.mdb"))
    > >
    > > Set rs = Server.CreateObject("ADODB.Recordset")
    > > sqlString="Select * From Video"
    > >
    > > rs.Open sqlString, conn, cursor, 2
    > >
    > > rs.addnew
    > >
    > > rs.Fields("VideoCode")=request.form("T1")
    > > rs.Fields("VideoTitle")=request.form("T2")
    > > rs.Fields("DateReleased")=request.form("T3")
    > > rs.Fields("Sypnosis")=request.form("T4")
    > > rs.Fields("Genre")=request.form("T5")
    > > rs.Fields("RunningTime")=request.form("T6")
    > >
    > > rs.update
    > >
    > > rs.close
    > >
    > > Response.Write request.form " updated!"
    > >
    > > conn.close
    > >
    > > %>
    > > - DSN connection
    > >
    > __________________________________________________ __________________________
    > ___
    > >
    > > <%
    > >
    > > VideoCode=Request.form("VideoCode")
    > > VideoTitle=Request.form("VideoTitle")
    > > DateReleased=Request.form("DateReleased")
    > > Synopsis=Request.form("Synopsis")
    > > Genre=Request.form("Genre")
    > > RunningTime=Request.form("RunningTime")
    > > Image=Request.form("Image")
    > >
    > >
    > > set Conn=Server.CreateObject("ADODB.Connection")
    > > Conn.Open "DSN=VideoMX"
    > >
    > >
    > > set userSet=CreateObject("ADODB.Recordset")
    > > userSet.ActiveConnection = Conn
    > > sqlText="Select * FROM Video WHERE VideoCode='"&VideoCode&"'"
    > > userSet.Open sqlText
    > > if userSet.EOF then
    > > theSQL="insert into Video"
    > > theSQL=theSQL &
    > "(VideoCode,VideoTitle,DateReleased,Synopsis,Genre ,RunningTime,Image)"
    > > theSQL=theSQL &
    > "values('"&VideoCode&"','"&VideoTitle&"','"&DateRe leased&"','"&Synopsis&"','
    > "&Genre&"','"&RunningTime&"','"&Image&"')"
    > >
    > > set userSet=Conn.Execute(theSQL)
    > > Response.Redirect("/mx/updtviddet.asp")
    > > Conn.close
    > > End if
    > > %>
    > > - DSN-less connection
    TsiuWeng Ng Guest

  7. #6

    Default Re: 3 days without sleep, posting here as a last resort

    Use an "ORDER BY" clause in your sql statement when you retrieve the data to
    control the order that records appear.

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    [url]www.ielearning.com[/url]


    "TsiuWeng Ng" <tsiuweng@msn.com> wrote in message
    news:731cdf4d.0312260731.5180a628@posting.google.c om...
    > Thanks ray,
    >
    > Its working now :) I used the get.Querystring().
    > I know the following question is a little lame ... it's now adding
    > records to the top of my database table, instead adding it to the
    > bottom. How do I solve that?
    >
    > Thanks for the help.
    >
    > Regards,
    > TsiuWeng
    >
    > "Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message
    news:<essQhRryDHA.3208@tk2msftngp13.phx.gbl>...
    > > Well, I don't know about the downloading of your page thing unless
    you're
    > > trying to call your page by C:\inetpub\wwwroot\yourpage.asp as opposed
    to
    > > [url]http://localhost[/url], but the one thing I noticed right away, aside from the
    > > fact that all your "T" values have no value, is that you're using
    > > request.FORM when it appears your form is using method=get. With
    > > method=get, your values are passed in the querystring, not a form
    > > collection, so you have to use request.QUERYSTRING("T1").
    > >
    > > Ray at home
    > >
    > > "TsiuWeng Ng" <tsiuweng@msn.com> wrote in message
    > > news:731cdf4d.0312242146.182fd85e@posting.google.c om...
    > > > Hi everyone,
    > > >
    > > > I'm developing a web application(VideoRental) using ASP with Access
    > > > as the database. My machine runs Windows XP. In my codes, I'm using a
    > > > DSN connection to the database.
    > > >
    > > > Initially, whenever I click on the page that's supposed to trigger
    > > > another page containing the ASP codes to connect to the database, a
    > > > download window appears and asks me whether do I want to download that
    > > > page!
    > > >
    > > > I however managed to solve that. But when I tried to connect to the
    > > > database using a DSN-less connection, the problem appeared again.
    > > >
    > > > The second type of problem that I encountered is the insertion of
    > > > blank rows into my database. Whenever I try to add new records into my
    > > > database(via a DSN connection), the data from my form is not passed
    > > > into the database. Instead, blank rows are inserted into my database.
    > > >
    > > > The values that appear on my browser's address bar are
    > > >
    > >
    [url]http://localhost/videomx2/db/addvideo2.asp?T1=&T2=&T3=&T4=&T5=&T6=&T7=&T8=&B[/url]
    > > 4=Submit.
    > > >
    > > > T1 to T8 are the names of the textbox that contain the values
    > > > that's to be passed to the database. B4 is the name of the submit
    > > > button.
    > > >
    > > > I would really appreciate any help that I can get. Below are my codes.
    > > >
    > > >
    > >
    ************************************************** **************************
    > > ***
    > > >
    > > > <%
    > > >
    > > > Set conn = Server.CreateObject("ADODB.Connection")
    > > >
    > > > Source=C:\Inetpub\wwwroot\VideoMX2\db\VideoMX.mdb; "
    > > > conn.provider = "microsoft.jet.OLEDB.4.0"
    > > >
    > > > conn.open(server.mappath("VideoMX.mdb"))
    > > >
    > > > Set rs = Server.CreateObject("ADODB.Recordset")
    > > > sqlString="Select * From Video"
    > > >
    > > > rs.Open sqlString, conn, cursor, 2
    > > >
    > > > rs.addnew
    > > >
    > > > rs.Fields("VideoCode")=request.form("T1")
    > > > rs.Fields("VideoTitle")=request.form("T2")
    > > > rs.Fields("DateReleased")=request.form("T3")
    > > > rs.Fields("Sypnosis")=request.form("T4")
    > > > rs.Fields("Genre")=request.form("T5")
    > > > rs.Fields("RunningTime")=request.form("T6")
    > > >
    > > > rs.update
    > > >
    > > > rs.close
    > > >
    > > > Response.Write request.form " updated!"
    > > >
    > > > conn.close
    > > >
    > > > %>
    > > > - DSN connection
    > > >
    > >
    __________________________________________________ __________________________
    > > ___
    > > >
    > > > <%
    > > >
    > > > VideoCode=Request.form("VideoCode")
    > > > VideoTitle=Request.form("VideoTitle")
    > > > DateReleased=Request.form("DateReleased")
    > > > Synopsis=Request.form("Synopsis")
    > > > Genre=Request.form("Genre")
    > > > RunningTime=Request.form("RunningTime")
    > > > Image=Request.form("Image")
    > > >
    > > >
    > > > set Conn=Server.CreateObject("ADODB.Connection")
    > > > Conn.Open "DSN=VideoMX"
    > > >
    > > >
    > > > set userSet=CreateObject("ADODB.Recordset")
    > > > userSet.ActiveConnection = Conn
    > > > sqlText="Select * FROM Video WHERE VideoCode='"&VideoCode&"'"
    > > > userSet.Open sqlText
    > > > if userSet.EOF then
    > > > theSQL="insert into Video"
    > > > theSQL=theSQL &
    > > "(VideoCode,VideoTitle,DateReleased,Synopsis,Genre ,RunningTime,Image)"
    > > > theSQL=theSQL &
    > >
    "values('"&VideoCode&"','"&VideoTitle&"','"&DateRe leased&"','"&Synopsis&"','
    > > "&Genre&"','"&RunningTime&"','"&Image&"')"
    > > >
    > > > set userSet=Conn.Execute(theSQL)
    > > > Response.Redirect("/mx/updtviddet.asp")
    > > > Conn.close
    > > > End if
    > > > %>
    > > > - DSN-less connection

    Mark Schupp 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