Ask a Question related to ASP Database, Design and Development.
-
TsiuWeng Ng #1
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
-
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... -
#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... -
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... -
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... -
Sleep/timer
Hi how do i make a frame delay for x ammount of seconds? Is there a sleep command? -
Ray at #2
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...[url]http://localhost/videomx2/db/addvideo2.asp?T1=&T2=&T3=&T4=&T5=&T6=&T7=&T8=&B[/url]> 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
>
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,VideoTitle,DateReleased,Synopsis,Genre ,RunningTime,Image)">
> <%
>
> 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 &"values('"&VideoCode&"','"&VideoTitle&"','"&DateRe leased&"','"&Synopsis&"','> theSQL=theSQL &
"&Genre&"','"&RunningTime&"','"&Image&"')">
> set userSet=Conn.Execute(theSQL)
> Response.Redirect("/mx/updtviddet.asp")
> Conn.close
> End if
> %>
> - DSN-less connection
Ray at Guest
-
Alistair #3
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
-
Ray at #4
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...Heh heh. I was away from my computer for almost the entire day, today. It>
>
> Don't you ever take time off Ray???
>
was not fun!
Ray at home
Ray at Guest
-
TsiuWeng Ng #5
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...> [url]http://localhost/videomx2/db/addvideo2.asp?T1=&T2=&T3=&T4=&T5=&T6=&T7=&T8=&B[/url]> > 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
> >
> 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,VideoTitle,DateReleased,Synopsis,Genre ,RunningTime,Image)"> >
> > <%
> >
> > 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 &> "values('"&VideoCode&"','"&VideoTitle&"','"&DateRe leased&"','"&Synopsis&"','> > theSQL=theSQL &
> "&Genre&"','"&RunningTime&"','"&Image&"')"> >
> > set userSet=Conn.Execute(theSQL)
> > Response.Redirect("/mx/updtviddet.asp")
> > Conn.close
> > End if
> > %>
> > - DSN-less connectionTsiuWeng Ng Guest
-
Mark Schupp #6
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...news:<essQhRryDHA.3208@tk2msftngp13.phx.gbl>...> 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 messageyou're> > Well, I don't know about the downloading of your page thing unlessto> > trying to call your page by C:\inetpub\wwwroot\yourpage.asp as opposed[url]http://localhost/videomx2/db/addvideo2.asp?T1=&T2=&T3=&T4=&T5=&T6=&T7=&T8=&B[/url]> > [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
> > >************************************************** **************************> > 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
> > >"values('"&VideoCode&"','"&VideoTitle&"','"&DateRe leased&"','"&Synopsis&"','> > ___> > "(VideoCode,VideoTitle,DateReleased,Synopsis,Genre ,RunningTime,Image)"> > >
> > > <%
> > >
> > > 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 &> >> > > theSQL=theSQL &> > "&Genre&"','"&RunningTime&"','"&Image&"')"> > >
> > > set userSet=Conn.Execute(theSQL)
> > > Response.Redirect("/mx/updtviddet.asp")
> > > Conn.close
> > > End if
> > > %>
> > > - DSN-less connection
Mark Schupp Guest



Reply With Quote

