Ask a Question related to ASP Database, Design and Development.
-
Vivista Eastbourne #1
Please help with data in 2 tables
Hi
I have 2 tables, one called SCR and one called userdetails
SCR table contains details of a change
Userdetails contains information about a user
All the data is entered via asp on our intranet
One of the SCR fields is Username
One of the Userdetails fields is also Username
Both tables currently have a seperate asp form (by request from above)
How can I check if the value entered for username on the SCR form exists as
a username value in the Userdetails form, and if it does, bring up the
record for that username, or if not, open up the blank form.
Bear in mind that the forms already exist, just really need pointers on the
code.
Any help is (as always) greatly appreciated
Many Thanks if you can help (you were all newbies once upon a time)
Andy G
Vivista Eastbourne Guest
-
Multiple tables for same data - how to sort
Hi We are developing an application that stores logging data in a mysql database. Due to some facts, we decided to store the loggingdata in a... -
one-to-many - how to display data from two tables?
Hi, I'm working with Access/VBScript/ASP. I have an events table that has: eventID venueID eventname ....I also have a venues table that... -
Queries on tables from different data sources
Hi I need to perform two queries in sequence on two identical access tables. The source table is coming from a dataset returned by a web method... -
Unbound tables or grids of data?
Can anyone suggest a solution: I would like to display data to the user in a tabular form, similar to the DataGrid control, but without using... -
Inserting into one table data from 2 tables and some input data.
Alrighty, I pull records from a database table onto a page based on vendor #. On this page I have an input box after each row of data that is just... -
Nicole Calinoiu #2
Re: Please help with data in 2 tables
Andy,
Put all the logic for determining whether your dealing with new or existing
user data in the user details page. In the SCR page, just use a link to the
user details page that passes the SCR user name in the query string. e.g.:
<a href="userdetails.asp?username=whatever">...</a>
In ther user details page, query the db based for data on the specified
user. If you get back any data, pre-populate all the controls with data on
the user. If you don't get back data from the db, leave all the controls
blank except for the user name (which you can populate with the value
received from the query string).
Don't bother flagging the row as an insert or update at the time of the
initial read from the db. Even if it's a new row when the page is initially
loaded, it might not be by the time it's saved (i.e.: another user may have
added data against the same user name in the interim). Just add logic to
the code that saves the edited data to the db to update/insert as necessary
at the time of the actual save.
HTH,
Nicole
"Vivista Eastbourne" <a@a.a> wrote in message
news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...as> Hi
>
> I have 2 tables, one called SCR and one called userdetails
> SCR table contains details of a change
> Userdetails contains information about a user
>
> All the data is entered via asp on our intranet
>
> One of the SCR fields is Username
> One of the Userdetails fields is also Username
>
> Both tables currently have a seperate asp form (by request from above)
>
> How can I check if the value entered for username on the SCR form existsthe> a username value in the Userdetails form, and if it does, bring up the
> record for that username, or if not, open up the blank form.
>
> Bear in mind that the forms already exist, just really need pointers on> code.
>
> Any help is (as always) greatly appreciated
>
> Many Thanks if you can help (you were all newbies once upon a time)
>
> Andy G
>
>
Nicole Calinoiu Guest
-
Vivista Eastbourne #3
Re: Please help with data in 2 tables
Hi Nicole,
Thanks for responding
I am fairly new to ASP and not fully up to speed.
Currently after the add button is pressed, the followiung is the submit
code:
<FORM name=frmDetail method=post
action="SCR_detail.asp<%=GetQueryString("Detail", Empty, Empty, Empty,
Empty)%>">
to follow your convention of <a
href="userdetails.asp?username=whatever">...</a>, I presume the code would
look like this:
<FORM name=frmDetail method=post
action="userdetails_detail.asp?vusername=vusername <%=GetQueryString("Detail"
, Empty, Empty, Empty, Empty)%>">
where vusername is the variable used on both forms in asp but in different
database tables, is this correct?
Also, what code would be required in the userdetails_detail.asp page to
check if the username exists in that table?
Thanks Again
Andy G
"Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
news:uE58CVNjDHA.2076@TK2MSFTNGP09.phx.gbl...existing> Andy,
>
> Put all the logic for determining whether your dealing with new orthe> user data in the user details page. In the SCR page, just use a link toe.g.:> user details page that passes the SCR user name in the query string.on>
> <a href="userdetails.asp?username=whatever">...</a>
>
> In ther user details page, query the db based for data on the specified
> user. If you get back any data, pre-populate all the controls with datainitially> the user. If you don't get back data from the db, leave all the controls
> blank except for the user name (which you can populate with the value
> received from the query string).
>
> Don't bother flagging the row as an insert or update at the time of the
> initial read from the db. Even if it's a new row when the page ishave> loaded, it might not be by the time it's saved (i.e.: another user maynecessary> added data against the same user name in the interim). Just add logic to
> the code that saves the edited data to the db to update/insert as> at the time of the actual save.
>
> HTH,
> Nicole
>
>
>
> "Vivista Eastbourne" <a@a.a> wrote in message
> news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...> as> > Hi
> >
> > I have 2 tables, one called SCR and one called userdetails
> > SCR table contains details of a change
> > Userdetails contains information about a user
> >
> > All the data is entered via asp on our intranet
> >
> > One of the SCR fields is Username
> > One of the Userdetails fields is also Username
> >
> > Both tables currently have a seperate asp form (by request from above)
> >
> > How can I check if the value entered for username on the SCR form exists> the> > a username value in the Userdetails form, and if it does, bring up the
> > record for that username, or if not, open up the blank form.
> >
> > Bear in mind that the forms already exist, just really need pointers on>> > code.
> >
> > Any help is (as always) greatly appreciated
> >
> > Many Thanks if you can help (you were all newbies once upon a time)
> >
> > Andy G
> >
> >
>
Vivista Eastbourne Guest
-
Nicole Calinoiu #4
Re: Please help with data in 2 tables
Andy,
I think I may have understood your problem incorrectly. When do you want to
launch the user details form? From a link on the SCR form? When the SCR
form data is saved? Some other trigger point?
Nicole
"Vivista Eastbourne" <a@a.a> wrote in message
news:3f82da5f$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...action="userdetails_detail.asp?vusername=vusername <%=GetQueryString("Detail"> Hi Nicole,
> Thanks for responding
> I am fairly new to ASP and not fully up to speed.
>
> Currently after the add button is pressed, the followiung is the submit
> code:
> <FORM name=frmDetail method=post
> action="SCR_detail.asp<%=GetQueryString("Detail", Empty, Empty, Empty,
> Empty)%>">
> to follow your convention of <a
> href="userdetails.asp?username=whatever">...</a>, I presume the code would
> look like this:
> <FORM name=frmDetail method=post
>controls> , Empty, Empty, Empty, Empty)%>">
> where vusername is the variable used on both forms in asp but in different
> database tables, is this correct?
>
> Also, what code would be required in the userdetails_detail.asp page to
> check if the username exists in that table?
>
> Thanks Again
>
> Andy G
>
> "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> news:uE58CVNjDHA.2076@TK2MSFTNGP09.phx.gbl...> existing> > Andy,
> >
> > Put all the logic for determining whether your dealing with new or> the> > user data in the user details page. In the SCR page, just use a link to> e.g.:> > user details page that passes the SCR user name in the query string.> on> >
> > <a href="userdetails.asp?username=whatever">...</a>
> >
> > In ther user details page, query the db based for data on the specified
> > user. If you get back any data, pre-populate all the controls with data> > the user. If you don't get back data from the db, leave all theto> initially> > blank except for the user name (which you can populate with the value
> > received from the query string).
> >
> > Don't bother flagging the row as an insert or update at the time of the
> > initial read from the db. Even if it's a new row when the page is> have> > loaded, it might not be by the time it's saved (i.e.: another user may> > added data against the same user name in the interim). Just add logicexists> necessary> > the code that saves the edited data to the db to update/insert as> > at the time of the actual save.
> >
> > HTH,
> > Nicole
> >
> >
> >
> > "Vivista Eastbourne" <a@a.a> wrote in message
> > news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...> > > Hi
> > >
> > > I have 2 tables, one called SCR and one called userdetails
> > > SCR table contains details of a change
> > > Userdetails contains information about a user
> > >
> > > All the data is entered via asp on our intranet
> > >
> > > One of the SCR fields is Username
> > > One of the Userdetails fields is also Username
> > >
> > > Both tables currently have a seperate asp form (by request from above)
> > >
> > > How can I check if the value entered for username on the SCR formon> > as> > > a username value in the Userdetails form, and if it does, bring up the
> > > record for that username, or if not, open up the blank form.
> > >
> > > Bear in mind that the forms already exist, just really need pointers>> > the> >> > > code.
> > >
> > > Any help is (as always) greatly appreciated
> > >
> > > Many Thanks if you can help (you were all newbies once upon a time)
> > >
> > > Andy G
> > >
> > >
> >
>
Nicole Calinoiu Guest
-
Vivista Eastbourne #5
Re: Please help with data in 2 tables
Hi Nicole
There is an add buttin on the SCR form which, when pressed, should add the
SCR record to the database, then redirect to the userdetails form and check
the 'username' from the SCR form in the userdetails table, if the name
exists in a record, bring up that record for updating, otherwise bring up
the form for a new record.
Thanks
Andy G
"Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
news:eLDtnlOjDHA.2076@TK2MSFTNGP09.phx.gbl...to> Andy,
>
> I think I may have understood your problem incorrectly. When do you wantwould> launch the user details form? From a link on the SCR form? When the SCR
> form data is saved? Some other trigger point?
>
> Nicole
>
>
> "Vivista Eastbourne" <a@a.a> wrote in message
> news:3f82da5f$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...> > Hi Nicole,
> > Thanks for responding
> > I am fairly new to ASP and not fully up to speed.
> >
> > Currently after the add button is pressed, the followiung is the submit
> > code:
> > <FORM name=frmDetail method=post
> > action="SCR_detail.asp<%=GetQueryString("Detail", Empty, Empty, Empty,
> > Empty)%>">
> > to follow your convention of <a
> > href="userdetails.asp?username=whatever">...</a>, I presume the codeaction="userdetails_detail.asp?vusername=vusername <%=GetQueryString("Detail">> > look like this:
> > <FORM name=frmDetail method=post
> >different> > , Empty, Empty, Empty, Empty)%>">
> > where vusername is the variable used on both forms in asp but into> > database tables, is this correct?
> >
> > Also, what code would be required in the userdetails_detail.asp page to
> > check if the username exists in that table?
> >
> > Thanks Again
> >
> > Andy G
> >
> > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > news:uE58CVNjDHA.2076@TK2MSFTNGP09.phx.gbl...> > existing> > > Andy,
> > >
> > > Put all the logic for determining whether your dealing with new or> > > user data in the user details page. In the SCR page, just use a linkspecified> > the> > e.g.:> > > user details page that passes the SCR user name in the query string.> > >
> > > <a href="userdetails.asp?username=whatever">...</a>
> > >
> > > In ther user details page, query the db based for data on thedata> > > user. If you get back any data, pre-populate all the controls withthe> controls> > on> > > the user. If you don't get back data from the db, leave all the> > > blank except for the user name (which you can populate with the value
> > > received from the query string).
> > >
> > > Don't bother flagging the row as an insert or update at the time ofabove)> to> > initially> > > initial read from the db. Even if it's a new row when the page is> > have> > > loaded, it might not be by the time it's saved (i.e.: another user may> > > added data against the same user name in the interim). Just add logic> > necessary> > > the code that saves the edited data to the db to update/insert as> > > at the time of the actual save.
> > >
> > > HTH,
> > > Nicole
> > >
> > >
> > >
> > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > Hi
> > > >
> > > > I have 2 tables, one called SCR and one called userdetails
> > > > SCR table contains details of a change
> > > > Userdetails contains information about a user
> > > >
> > > > All the data is entered via asp on our intranet
> > > >
> > > > One of the SCR fields is Username
> > > > One of the Userdetails fields is also Username
> > > >
> > > > Both tables currently have a seperate asp form (by request fromthe> exists> > > >
> > > > How can I check if the value entered for username on the SCR form> > > as
> > > > a username value in the Userdetails form, and if it does, bring up> on> > > > record for that username, or if not, open up the blank form.
> > > >
> > > > Bear in mind that the forms already exist, just really need pointers>> >> > > the
> > > > code.
> > > >
> > > > Any help is (as always) greatly appreciated
> > > >
> > > > Many Thanks if you can help (you were all newbies once upon a time)
> > > >
> > > > Andy G
> > > >
> > > >
> > >
> > >
> >
>
Vivista Eastbourne Guest
-
Nicole Calinoiu #6
Re: Please help with data in 2 tables
Andy,
In that case, instead of a link on the SCR page, you need to redirect to the
user details page after completing the save from the server-side code of the
SCR page. Let's say that by the time of the sucessful save in the SCR page,
the user name is stored in a variable named strUserName. After completing
the save and performing any necessary clean-up activity in the SCR page,
just use the following line of code to redirect to the user details page:
Response.Redirect "UserDetails.asp?UserName=" & strUserName
This will cause a client-side redirection to the user details page, with the
target user name included in the query string.
HTH,
Nicole
"Vivista Eastbourne" <a@a.a> wrote in message
news:3f83bc15$0$125$7b0f0fd3@mistral.news.newnet.c o.uk...check> Hi Nicole
>
> There is an add buttin on the SCR form which, when pressed, should add the
> SCR record to the database, then redirect to the userdetails form andwant> the 'username' from the SCR form in the userdetails table, if the name
> exists in a record, bring up that record for updating, otherwise bring up
> the form for a new record.
>
> Thanks
>
> Andy G
>
> "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> news:eLDtnlOjDHA.2076@TK2MSFTNGP09.phx.gbl...> > Andy,
> >
> > I think I may have understood your problem incorrectly. When do youSCR> to> > launch the user details form? From a link on the SCR form? When thesubmit> > form data is saved? Some other trigger point?
> >
> > Nicole
> >
> >
> > "Vivista Eastbourne" <a@a.a> wrote in message
> > news:3f82da5f$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...> > > Hi Nicole,
> > > Thanks for responding
> > > I am fairly new to ASP and not fully up to speed.
> > >
> > > Currently after the add button is pressed, the followiung is theaction="userdetails_detail.asp?vusername=vusername <%=GetQueryString("Detail"> would> > > code:
> > > <FORM name=frmDetail method=post
> > > action="SCR_detail.asp<%=GetQueryString("Detail", Empty, Empty, Empty,
> > > Empty)%>">
> > > to follow your convention of <a
> > > href="userdetails.asp?username=whatever">...</a>, I presume the code>> >> > > look like this:
> > > <FORM name=frmDetail method=post
> > >to> different> > > , Empty, Empty, Empty, Empty)%>">
> > > where vusername is the variable used on both forms in asp but in> > > database tables, is this correct?
> > >
> > > Also, what code would be required in the userdetails_detail.asp pagelink> > > check if the username exists in that table?
> > >
> > > Thanks Again
> > >
> > > Andy G
> > >
> > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > news:uE58CVNjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > Andy,
> > > >
> > > > Put all the logic for determining whether your dealing with new or
> > > existing
> > > > user data in the user details page. In the SCR page, just use avalue> to> specified> > > the
> > > > user details page that passes the SCR user name in the query string.
> > > e.g.:
> > > >
> > > > <a href="userdetails.asp?username=whatever">...</a>
> > > >
> > > > In ther user details page, query the db based for data on the> data> > > > user. If you get back any data, pre-populate all the controls with> > controls> > > on
> > > > the user. If you don't get back data from the db, leave all the> > > > blank except for the user name (which you can populate with themay> the> > > > received from the query string).
> > > >
> > > > Don't bother flagging the row as an insert or update at the time of> > > > initial read from the db. Even if it's a new row when the page is
> > > initially
> > > > loaded, it might not be by the time it's saved (i.e.: another userlogic> > > have
> > > > added data against the same user name in the interim). Just addpointers> above)> > to> > > > the code that saves the edited data to the db to update/insert as
> > > necessary
> > > > at the time of the actual save.
> > > >
> > > > HTH,
> > > > Nicole
> > > >
> > > >
> > > >
> > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > Hi
> > > > >
> > > > > I have 2 tables, one called SCR and one called userdetails
> > > > > SCR table contains details of a change
> > > > > Userdetails contains information about a user
> > > > >
> > > > > All the data is entered via asp on our intranet
> > > > >
> > > > > One of the SCR fields is Username
> > > > > One of the Userdetails fields is also Username
> > > > >
> > > > > Both tables currently have a seperate asp form (by request from> the> > exists> > > > >
> > > > > How can I check if the value entered for username on the SCR form> > > > as
> > > > > a username value in the Userdetails form, and if it does, bring up> > > > > record for that username, or if not, open up the blank form.
> > > > >
> > > > > Bear in mind that the forms already exist, just really needtime)> > on> > > > the
> > > > > code.
> > > > >
> > > > > Any help is (as always) greatly appreciated
> > > > >
> > > > > Many Thanks if you can help (you were all newbies once upon a>> >> > > > >
> > > > > Andy G
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Nicole Calinoiu Guest
-
Vivista Eastbourne #7
Re: Please help with data in 2 tables
Hi Nicole,
Thanks for that, but how would I have the asp query the databases username
field in all the records and determine if that record existed?
Thanks Again for all your help
I have been racking my brains with this part of the project.
Cheers
Andy G
"Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
news:u23rUenjDHA.1488@TK2MSFTNGP12.phx.gbl...the> Andy,
>
> In that case, instead of a link on the SCR page, you need to redirect tothe> user details page after completing the save from the server-side code ofpage,> SCR page. Let's say that by the time of the sucessful save in the SCRthe> the user name is stored in a variable named strUserName. After completing
> the save and performing any necessary clean-up activity in the SCR page,
> just use the following line of code to redirect to the user details page:
>
> Response.Redirect "UserDetails.asp?UserName=" & strUserName
>
> This will cause a client-side redirection to the user details page, withthe> target user name included in the query string.
>
> HTH,
> Nicole
>
>
>
>
> "Vivista Eastbourne" <a@a.a> wrote in message
> news:3f83bc15$0$125$7b0f0fd3@mistral.news.newnet.c o.uk...> > Hi Nicole
> >
> > There is an add buttin on the SCR form which, when pressed, should addup> check> > SCR record to the database, then redirect to the userdetails form and> > the 'username' from the SCR form in the userdetails table, if the name
> > exists in a record, bring up that record for updating, otherwise bringEmpty,> want> > the form for a new record.
> >
> > Thanks
> >
> > Andy G
> >
> > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > news:eLDtnlOjDHA.2076@TK2MSFTNGP09.phx.gbl...> > > Andy,
> > >
> > > I think I may have understood your problem incorrectly. When do you> SCR> > to> > > launch the user details form? From a link on the SCR form? When the> submit> > > form data is saved? Some other trigger point?
> > >
> > > Nicole
> > >
> > >
> > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > news:3f82da5f$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > Hi Nicole,
> > > > Thanks for responding
> > > > I am fairly new to ASP and not fully up to speed.
> > > >
> > > > Currently after the add button is pressed, the followiung is the> > > > code:
> > > > <FORM name=frmDetail method=post
> > > > action="SCR_detail.asp<%=GetQueryString("Detail", Empty, Empty,action="userdetails_detail.asp?vusername=vusername <%=GetQueryString("Detail">> > would> > > > Empty)%>">
> > > > to follow your convention of <a
> > > > href="userdetails.asp?username=whatever">...</a>, I presume the code> >> > > > look like this:
> > > > <FORM name=frmDetail method=post
> > > >
> > >string.> to> > different> > > > , Empty, Empty, Empty, Empty)%>">
> > > > where vusername is the variable used on both forms in asp but in> > > > database tables, is this correct?
> > > >
> > > > Also, what code would be required in the userdetails_detail.asp page> link> > > > check if the username exists in that table?
> > > >
> > > > Thanks Again
> > > >
> > > > Andy G
> > > >
> > > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > > news:uE58CVNjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > > Andy,
> > > > >
> > > > > Put all the logic for determining whether your dealing with new or
> > > > existing
> > > > > user data in the user details page. In the SCR page, just use a> > to> > > > the
> > > > > user details page that passes the SCR user name in the querywith> > specified> > > > e.g.:
> > > > >
> > > > > <a href="userdetails.asp?username=whatever">...</a>
> > > > >
> > > > > In ther user details page, query the db based for data on the> > > > > user. If you get back any data, pre-populate all the controlsof> value> > data> > > > on
> > > > > the user. If you don't get back data from the db, leave all the
> > > controls
> > > > > blank except for the user name (which you can populate with the> > > > > received from the query string).
> > > > >
> > > > > Don't bother flagging the row as an insert or update at the timeform> may> > the> > > > > initial read from the db. Even if it's a new row when the page is
> > > > initially
> > > > > loaded, it might not be by the time it's saved (i.e.: another user> logic> > > > have
> > > > > added data against the same user name in the interim). Just add> > above)> > > to
> > > > > the code that saves the edited data to the db to update/insert as
> > > > necessary
> > > > > at the time of the actual save.
> > > > >
> > > > > HTH,
> > > > > Nicole
> > > > >
> > > > >
> > > > >
> > > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > > news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > > Hi
> > > > > >
> > > > > > I have 2 tables, one called SCR and one called userdetails
> > > > > > SCR table contains details of a change
> > > > > > Userdetails contains information about a user
> > > > > >
> > > > > > All the data is entered via asp on our intranet
> > > > > >
> > > > > > One of the SCR fields is Username
> > > > > > One of the Userdetails fields is also Username
> > > > > >
> > > > > > Both tables currently have a seperate asp form (by request from> > > > > >
> > > > > > How can I check if the value entered for username on the SCRup> > > exists
> > > > > as
> > > > > > a username value in the Userdetails form, and if it does, bring> pointers> > the> > > > > > record for that username, or if not, open up the blank form.
> > > > > >
> > > > > > Bear in mind that the forms already exist, just really need> time)> > > on
> > > > > the
> > > > > > code.
> > > > > >
> > > > > > Any help is (as always) greatly appreciated
> > > > > >
> > > > > > Many Thanks if you can help (you were all newbies once upon a>> >> > > > > >
> > > > > > Andy G
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Vivista Eastbourne Guest
-
Nicole Calinoiu #8
Re: Please help with data in 2 tables
Andy,
For this, you don't need to query the db to find out if a row for the user
name already exists since you need the data for the user anyway if it does.
Since you haven't mentioned which database platform you're using, it'a wee
bit difficult to give any details of the querying approach. However, here's
some general guidelines:
1. Set up a parameterized stored query (Access) or a stored procedure (SQL
Server) in the following form:
SELECT <the columns you want to display on the form>
FROM <your users table>
WHERE <the user name column> = <the user name parameter>
2. User the ADO Command object in your user details page to execute this
stored query/procedure, passing the user name received from the URL query
string as the value the user name parameter, and returning an ADO Recordset
object.
3. Assuming you have a uniqueness contraint on the user name column in your
users table, the recordset returned from step #2 will contain either one row
(the matching user) or no rows (indicating that it's a new user name). If
the recordset does contain a row, use the values from the recordset fields
to pre-populate the input elements on your form. If it doesn't contain a
row, leave the inputs blank or give them appropriate default values.
If you need help with the details of any particular aspect of this, please
specify what exactly.
HTH,
Nicole
"Vivista Eastbourne" <a@a.a> wrote in message
news:3f8583b0$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...completing> Hi Nicole,
>
> Thanks for that, but how would I have the asp query the databases username
> field in all the records and determine if that record existed?
> Thanks Again for all your help
> I have been racking my brains with this part of the project.
> Cheers
>
> Andy G
>
>
> "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> news:u23rUenjDHA.1488@TK2MSFTNGP12.phx.gbl...> the> > Andy,
> >
> > In that case, instead of a link on the SCR page, you need to redirect to> the> > user details page after completing the save from the server-side code of> page,> > SCR page. Let's say that by the time of the sucessful save in the SCR> > the user name is stored in a variable named strUserName. Afterpage:> > the save and performing any necessary clean-up activity in the SCR page,
> > just use the following line of code to redirect to the user detailsthe> the> >
> > Response.Redirect "UserDetails.asp?UserName=" & strUserName
> >
> > This will cause a client-side redirection to the user details page, with> the> > target user name included in the query string.
> >
> > HTH,
> > Nicole
> >
> >
> >
> >
> > "Vivista Eastbourne" <a@a.a> wrote in message
> > news:3f83bc15$0$125$7b0f0fd3@mistral.news.newnet.c o.uk...> > > Hi Nicole
> > >
> > > There is an add buttin on the SCR form which, when pressed, should add> up> > check> > > SCR record to the database, then redirect to the userdetails form and> > > the 'username' from the SCR form in the userdetails table, if the name
> > > exists in a record, bring up that record for updating, otherwise bring> > want> > > the form for a new record.
> > >
> > > Thanks
> > >
> > > Andy G
> > >
> > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > news:eLDtnlOjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > Andy,
> > > >
> > > > I think I may have understood your problem incorrectly. When do you> > > to
> > > > launch the user details form? From a link on the SCR form? Whencode> Empty,> > SCR> > submit> > > > form data is saved? Some other trigger point?
> > > >
> > > > Nicole
> > > >
> > > >
> > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > news:3f82da5f$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > Hi Nicole,
> > > > > Thanks for responding
> > > > > I am fairly new to ASP and not fully up to speed.
> > > > >
> > > > > Currently after the add button is pressed, the followiung is the> > > > > code:
> > > > > <FORM name=frmDetail method=post
> > > > > action="SCR_detail.asp<%=GetQueryString("Detail", Empty, Empty,> > > > > Empty)%>">
> > > > > to follow your convention of <a
> > > > > href="userdetails.asp?username=whatever">...</a>, I presume theaction="userdetails_detail.asp?vusername=vusername <%=GetQueryString("Detail">> >> > > would
> > > > > look like this:
> > > > > <FORM name=frmDetail method=post
> > > > >
> > > >
> > >page> > > > > , Empty, Empty, Empty, Empty)%>">
> > > > > where vusername is the variable used on both forms in asp but in
> > > different
> > > > > database tables, is this correct?
> > > > >
> > > > > Also, what code would be required in the userdetails_detail.aspor> > to> > > > > check if the username exists in that table?
> > > > >
> > > > > Thanks Again
> > > > >
> > > > > Andy G
> > > > >
> > > > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > > > news:uE58CVNjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > > > Andy,
> > > > > >
> > > > > > Put all the logic for determining whether your dealing with newis> string.> > link> > > > > existing
> > > > > > user data in the user details page. In the SCR page, just use a> > > to
> > > > > the
> > > > > > user details page that passes the SCR user name in the query> with> > > > > e.g.:
> > > > > >
> > > > > > <a href="userdetails.asp?username=whatever">...</a>
> > > > > >
> > > > > > In ther user details page, query the db based for data on the
> > > specified
> > > > > > user. If you get back any data, pre-populate all the controls> of> > value> > > data
> > > > > on
> > > > > > the user. If you don't get back data from the db, leave all the
> > > > controls
> > > > > > blank except for the user name (which you can populate with the> > > > > > received from the query string).
> > > > > >
> > > > > > Don't bother flagging the row as an insert or update at the time> > > the
> > > > > > initial read from the db. Even if it's a new row when the pageuser> > > > > initially
> > > > > > loaded, it might not be by the time it's saved (i.e.: anotheras> > may> > logic> > > > > have
> > > > > > added data against the same user name in the interim). Just add> > > > to
> > > > > > the code that saves the edited data to the db to update/insertfrom> > > > > necessary
> > > > > > at the time of the actual save.
> > > > > >
> > > > > > HTH,
> > > > > > Nicole
> > > > > >
> > > > > >
> > > > > >
> > > > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > > > news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > > > Hi
> > > > > > >
> > > > > > > I have 2 tables, one called SCR and one called userdetails
> > > > > > > SCR table contains details of a change
> > > > > > > Userdetails contains information about a user
> > > > > > >
> > > > > > > All the data is entered via asp on our intranet
> > > > > > >
> > > > > > > One of the SCR fields is Username
> > > > > > > One of the Userdetails fields is also Username
> > > > > > >
> > > > > > > Both tables currently have a seperate asp form (by requestbring> form> > > above)
> > > > > > >
> > > > > > > How can I check if the value entered for username on the SCR> > > > exists
> > > > > > as
> > > > > > > a username value in the Userdetails form, and if it does,> up>> > pointers> > > the
> > > > > > > record for that username, or if not, open up the blank form.
> > > > > > >
> > > > > > > Bear in mind that the forms already exist, just really need> > time)> > > > on
> > > > > > the
> > > > > > > code.
> > > > > > >
> > > > > > > Any help is (as always) greatly appreciated
> > > > > > >
> > > > > > > Many Thanks if you can help (you were all newbies once upon a> >> > > > > > >
> > > > > > > Andy G
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Nicole Calinoiu Guest
-
Vivista Eastbourne #9
Re: Please help with data in 2 tables
Hi Nicole,
Thanks again.
The Database is an Access database called userdetails.mdb
The table is called UserDetails
The field is called Username and is unique
SELECT * FROM Userdetails WHERE username = strUsername
Is this correct?
Also, in part 2 of your last response, how would I use the ADO command set?
In part 3, how would I code this?
Thanks
"Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
news:Oa0elEojDHA.2512@TK2MSFTNGP09.phx.gbl...does.> Andy,
>
> For this, you don't need to query the db to find out if a row for the user
> name already exists since you need the data for the user anyway if ithere's> Since you haven't mentioned which database platform you're using, it'a wee
> bit difficult to give any details of the querying approach. However,(SQL> some general guidelines:
>
> 1. Set up a parameterized stored query (Access) or a stored procedureRecordset> Server) in the following form:
> SELECT <the columns you want to display on the form>
> FROM <your users table>
> WHERE <the user name column> = <the user name parameter>
> 2. User the ADO Command object in your user details page to execute this
> stored query/procedure, passing the user name received from the URL query
> string as the value the user name parameter, and returning an ADOyour> object.
> 3. Assuming you have a uniqueness contraint on the user name column inrow> users table, the recordset returned from step #2 will contain either oneusername> (the matching user) or no rows (indicating that it's a new user name). If
> the recordset does contain a row, use the values from the recordset fields
> to pre-populate the input elements on your form. If it doesn't contain a
> row, leave the inputs blank or give them appropriate default values.
>
> If you need help with the details of any particular aspect of this, please
> specify what exactly.
>
> HTH,
> Nicole
>
>
>
>
> "Vivista Eastbourne" <a@a.a> wrote in message
> news:3f8583b0$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...> > Hi Nicole,
> >
> > Thanks for that, but how would I have the asp query the databasesto> > field in all the records and determine if that record existed?
> > Thanks Again for all your help
> > I have been racking my brains with this part of the project.
> > Cheers
> >
> > Andy G
> >
> >
> > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > news:u23rUenjDHA.1488@TK2MSFTNGP12.phx.gbl...> > > Andy,
> > >
> > > In that case, instead of a link on the SCR page, you need to redirectof> > the> > > user details page after completing the save from the server-side codepage,> completing> > the> > page,> > > SCR page. Let's say that by the time of the sucessful save in the SCR> > > the user name is stored in a variable named strUserName. After> > > the save and performing any necessary clean-up activity in the SCRwith> page:> > > just use the following line of code to redirect to the user details> > >
> > > Response.Redirect "UserDetails.asp?UserName=" & strUserName
> > >
> > > This will cause a client-side redirection to the user details page,add> > the> > > target user name included in the query string.
> > >
> > > HTH,
> > > Nicole
> > >
> > >
> > >
> > >
> > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > news:3f83bc15$0$125$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > Hi Nicole
> > > >
> > > > There is an add buttin on the SCR form which, when pressed, shouldand> > the> > > > SCR record to the database, then redirect to the userdetails formname> > > check
> > > > the 'username' from the SCR form in the userdetails table, if thebring> > > > exists in a record, bring up that record for updating, otherwiseyou> > up> > > > the form for a new record.
> > > >
> > > > Thanks
> > > >
> > > > Andy G
> > > >
> > > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > > news:eLDtnlOjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > > Andy,
> > > > >
> > > > > I think I may have understood your problem incorrectly. When doaction="userdetails_detail.asp?vusername=vusername <%=GetQueryString("Detail"> the> > > want
> > > > to
> > > > > launch the user details form? From a link on the SCR form? When> code> > Empty,> > > SCR
> > > > > form data is saved? Some other trigger point?
> > > > >
> > > > > Nicole
> > > > >
> > > > >
> > > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > > news:3f82da5f$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > > Hi Nicole,
> > > > > > Thanks for responding
> > > > > > I am fairly new to ASP and not fully up to speed.
> > > > > >
> > > > > > Currently after the add button is pressed, the followiung is the
> > > submit
> > > > > > code:
> > > > > > <FORM name=frmDetail method=post
> > > > > > action="SCR_detail.asp<%=GetQueryString("Detail", Empty, Empty,> > > > > > Empty)%>">
> > > > > > to follow your convention of <a
> > > > > > href="userdetails.asp?username=whatever">...</a>, I presume the>> >> > > > would
> > > > > > look like this:
> > > > > > <FORM name=frmDetail method=post
> > > > > >
> > > > >
> > > >
> > >new> page> > > > > > , Empty, Empty, Empty, Empty)%>">
> > > > > > where vusername is the variable used on both forms in asp but in
> > > > different
> > > > > > database tables, is this correct?
> > > > > >
> > > > > > Also, what code would be required in the userdetails_detail.asp> > > to
> > > > > > check if the username exists in that table?
> > > > > >
> > > > > > Thanks Again
> > > > > >
> > > > > > Andy G
> > > > > >
> > > > > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > > > > news:uE58CVNjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > > > > Andy,
> > > > > > >
> > > > > > > Put all the logic for determining whether your dealing witha> or> > > > > > existing
> > > > > > > user data in the user details page. In the SCR page, just usethe> > string.> > > link
> > > > to
> > > > > > the
> > > > > > > user details page that passes the SCR user name in the query> > with> > > > > > e.g.:
> > > > > > >
> > > > > > > <a href="userdetails.asp?username=whatever">...</a>
> > > > > > >
> > > > > > > In ther user details page, query the db based for data on the
> > > > specified
> > > > > > > user. If you get back any data, pre-populate all the controls> > > > data
> > > > > > on
> > > > > > > the user. If you don't get back data from the db, leave allthe> > > > > controls
> > > > > > > blank except for the user name (which you can populate withtime> > > value
> > > > > > > received from the query string).
> > > > > > >
> > > > > > > Don't bother flagging the row as an insert or update at thepage> > of> > > > the
> > > > > > > initial read from the db. Even if it's a new row when theadd> is> user> > > > > > initially
> > > > > > > loaded, it might not be by the time it's saved (i.e.: another> > > may
> > > > > > have
> > > > > > > added data against the same user name in the interim). Justa> as> > > logic
> > > > > to
> > > > > > > the code that saves the edited data to the db to update/insert> from> > > > > > necessary
> > > > > > > at the time of the actual save.
> > > > > > >
> > > > > > > HTH,
> > > > > > > Nicole
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > > > > news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > > > > Hi
> > > > > > > >
> > > > > > > > I have 2 tables, one called SCR and one called userdetails
> > > > > > > > SCR table contains details of a change
> > > > > > > > Userdetails contains information about a user
> > > > > > > >
> > > > > > > > All the data is entered via asp on our intranet
> > > > > > > >
> > > > > > > > One of the SCR fields is Username
> > > > > > > > One of the Userdetails fields is also Username
> > > > > > > >
> > > > > > > > Both tables currently have a seperate asp form (by request> bring> > form> > > > above)
> > > > > > > >
> > > > > > > > How can I check if the value entered for username on the SCR> > > > > exists
> > > > > > > as
> > > > > > > > a username value in the Userdetails form, and if it does,> > up> > > > the
> > > > > > > > record for that username, or if not, open up the blank form.
> > > > > > > >
> > > > > > > > Bear in mind that the forms already exist, just really need
> > > pointers
> > > > > on
> > > > > > > the
> > > > > > > > code.
> > > > > > > >
> > > > > > > > Any help is (as always) greatly appreciated
> > > > > > > >
> > > > > > > > Many Thanks if you can help (you were all newbies once upon>> >> > > time)
> > > > > > > >
> > > > > > > > Andy G
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Vivista Eastbourne Guest
-
Vivista Eastbourne #10
Re: Please help with data in 2 tables
Hi Nicole,
Thanks again.
The Database is an Access database called userdetails.mdb
The table is called UserDetails
The field is called Username and is unique
SELECT * FROM Userdetails WHERE username = strUsername
Is this correct?
Also, in part 2 of your last response, how would I use the ADO command set?
In part 3, how would I code this?
Thanks
"Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
news:Oa0elEojDHA.2512@TK2MSFTNGP09.phx.gbl...does.> Andy,
>
> For this, you don't need to query the db to find out if a row for the user
> name already exists since you need the data for the user anyway if ithere's> Since you haven't mentioned which database platform you're using, it'a wee
> bit difficult to give any details of the querying approach. However,(SQL> some general guidelines:
>
> 1. Set up a parameterized stored query (Access) or a stored procedureRecordset> Server) in the following form:
> SELECT <the columns you want to display on the form>
> FROM <your users table>
> WHERE <the user name column> = <the user name parameter>
> 2. User the ADO Command object in your user details page to execute this
> stored query/procedure, passing the user name received from the URL query
> string as the value the user name parameter, and returning an ADOyour> object.
> 3. Assuming you have a uniqueness contraint on the user name column inrow> users table, the recordset returned from step #2 will contain either oneusername> (the matching user) or no rows (indicating that it's a new user name). If
> the recordset does contain a row, use the values from the recordset fields
> to pre-populate the input elements on your form. If it doesn't contain a
> row, leave the inputs blank or give them appropriate default values.
>
> If you need help with the details of any particular aspect of this, please
> specify what exactly.
>
> HTH,
> Nicole
>
>
>
>
> "Vivista Eastbourne" <a@a.a> wrote in message
> news:3f8583b0$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...> > Hi Nicole,
> >
> > Thanks for that, but how would I have the asp query the databasesto> > field in all the records and determine if that record existed?
> > Thanks Again for all your help
> > I have been racking my brains with this part of the project.
> > Cheers
> >
> > Andy G
> >
> >
> > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > news:u23rUenjDHA.1488@TK2MSFTNGP12.phx.gbl...> > > Andy,
> > >
> > > In that case, instead of a link on the SCR page, you need to redirectof> > the> > > user details page after completing the save from the server-side codepage,> completing> > the> > page,> > > SCR page. Let's say that by the time of the sucessful save in the SCR> > > the user name is stored in a variable named strUserName. After> > > the save and performing any necessary clean-up activity in the SCRwith> page:> > > just use the following line of code to redirect to the user details> > >
> > > Response.Redirect "UserDetails.asp?UserName=" & strUserName
> > >
> > > This will cause a client-side redirection to the user details page,add> > the> > > target user name included in the query string.
> > >
> > > HTH,
> > > Nicole
> > >
> > >
> > >
> > >
> > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > news:3f83bc15$0$125$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > Hi Nicole
> > > >
> > > > There is an add buttin on the SCR form which, when pressed, shouldand> > the> > > > SCR record to the database, then redirect to the userdetails formname> > > check
> > > > the 'username' from the SCR form in the userdetails table, if thebring> > > > exists in a record, bring up that record for updating, otherwiseyou> > up> > > > the form for a new record.
> > > >
> > > > Thanks
> > > >
> > > > Andy G
> > > >
> > > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > > news:eLDtnlOjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > > Andy,
> > > > >
> > > > > I think I may have understood your problem incorrectly. When doaction="userdetails_detail.asp?vusername=vusername <%=GetQueryString("Detail"> the> > > want
> > > > to
> > > > > launch the user details form? From a link on the SCR form? When> code> > Empty,> > > SCR
> > > > > form data is saved? Some other trigger point?
> > > > >
> > > > > Nicole
> > > > >
> > > > >
> > > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > > news:3f82da5f$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > > Hi Nicole,
> > > > > > Thanks for responding
> > > > > > I am fairly new to ASP and not fully up to speed.
> > > > > >
> > > > > > Currently after the add button is pressed, the followiung is the
> > > submit
> > > > > > code:
> > > > > > <FORM name=frmDetail method=post
> > > > > > action="SCR_detail.asp<%=GetQueryString("Detail", Empty, Empty,> > > > > > Empty)%>">
> > > > > > to follow your convention of <a
> > > > > > href="userdetails.asp?username=whatever">...</a>, I presume the>> >> > > > would
> > > > > > look like this:
> > > > > > <FORM name=frmDetail method=post
> > > > > >
> > > > >
> > > >
> > >new> page> > > > > > , Empty, Empty, Empty, Empty)%>">
> > > > > > where vusername is the variable used on both forms in asp but in
> > > > different
> > > > > > database tables, is this correct?
> > > > > >
> > > > > > Also, what code would be required in the userdetails_detail.asp> > > to
> > > > > > check if the username exists in that table?
> > > > > >
> > > > > > Thanks Again
> > > > > >
> > > > > > Andy G
> > > > > >
> > > > > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > > > > news:uE58CVNjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > > > > Andy,
> > > > > > >
> > > > > > > Put all the logic for determining whether your dealing witha> or> > > > > > existing
> > > > > > > user data in the user details page. In the SCR page, just usethe> > string.> > > link
> > > > to
> > > > > > the
> > > > > > > user details page that passes the SCR user name in the query> > with> > > > > > e.g.:
> > > > > > >
> > > > > > > <a href="userdetails.asp?username=whatever">...</a>
> > > > > > >
> > > > > > > In ther user details page, query the db based for data on the
> > > > specified
> > > > > > > user. If you get back any data, pre-populate all the controls> > > > data
> > > > > > on
> > > > > > > the user. If you don't get back data from the db, leave allthe> > > > > controls
> > > > > > > blank except for the user name (which you can populate withtime> > > value
> > > > > > > received from the query string).
> > > > > > >
> > > > > > > Don't bother flagging the row as an insert or update at thepage> > of> > > > the
> > > > > > > initial read from the db. Even if it's a new row when theadd> is> user> > > > > > initially
> > > > > > > loaded, it might not be by the time it's saved (i.e.: another> > > may
> > > > > > have
> > > > > > > added data against the same user name in the interim). Justa> as> > > logic
> > > > > to
> > > > > > > the code that saves the edited data to the db to update/insert> from> > > > > > necessary
> > > > > > > at the time of the actual save.
> > > > > > >
> > > > > > > HTH,
> > > > > > > Nicole
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > > > > news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > > > > Hi
> > > > > > > >
> > > > > > > > I have 2 tables, one called SCR and one called userdetails
> > > > > > > > SCR table contains details of a change
> > > > > > > > Userdetails contains information about a user
> > > > > > > >
> > > > > > > > All the data is entered via asp on our intranet
> > > > > > > >
> > > > > > > > One of the SCR fields is Username
> > > > > > > > One of the Userdetails fields is also Username
> > > > > > > >
> > > > > > > > Both tables currently have a seperate asp form (by request> bring> > form> > > > above)
> > > > > > > >
> > > > > > > > How can I check if the value entered for username on the SCR> > > > > exists
> > > > > > > as
> > > > > > > > a username value in the Userdetails form, and if it does,> > up> > > > the
> > > > > > > > record for that username, or if not, open up the blank form.
> > > > > > > >
> > > > > > > > Bear in mind that the forms already exist, just really need
> > > pointers
> > > > > on
> > > > > > > the
> > > > > > > > code.
> > > > > > > >
> > > > > > > > Any help is (as always) greatly appreciated
> > > > > > > >
> > > > > > > > Many Thanks if you can help (you were all newbies once upon>> >> > > time)
> > > > > > > >
> > > > > > > > Andy G
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Vivista Eastbourne Guest
-
Vivista Eastbourne #11
Please help with data in 2 tables
Hi Nicole,
Thanks again.
The Database is an Access database called userdetails.mdb
The table is called UserDetails
The field is called Username and is unique
SELECT * FROM Userdetails WHERE username = strUsername
Is this correct?
Also, in part 2 of your last response, how would I use the ADO command set?
In part 3, how would I code this?
Thanks
"Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
news:Oa0elEojDHA.2512@TK2MSFTNGP09.phx.gbl...does.> Andy,
>
> For this, you don't need to query the db to find out if a row for the user
> name already exists since you need the data for the user anyway if ithere's> Since you haven't mentioned which database platform you're using, it'a wee
> bit difficult to give any details of the querying approach. However,(SQL> some general guidelines:
>
> 1. Set up a parameterized stored query (Access) or a stored procedureRecordset> Server) in the following form:
> SELECT <the columns you want to display on the form>
> FROM <your users table>
> WHERE <the user name column> = <the user name parameter>
> 2. User the ADO Command object in your user details page to execute this
> stored query/procedure, passing the user name received from the URL query
> string as the value the user name parameter, and returning an ADOyour> object.
> 3. Assuming you have a uniqueness contraint on the user name column inrow> users table, the recordset returned from step #2 will contain either oneusername> (the matching user) or no rows (indicating that it's a new user name). If
> the recordset does contain a row, use the values from the recordset fields
> to pre-populate the input elements on your form. If it doesn't contain a
> row, leave the inputs blank or give them appropriate default values.
>
> If you need help with the details of any particular aspect of this, please
> specify what exactly.
>
> HTH,
> Nicole
>
>
>
>
> "Vivista Eastbourne" <a@a.a> wrote in message
> news:3f8583b0$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...> > Hi Nicole,
> >
> > Thanks for that, but how would I have the asp query the databasesto> > field in all the records and determine if that record existed?
> > Thanks Again for all your help
> > I have been racking my brains with this part of the project.
> > Cheers
> >
> > Andy G
> >
> >
> > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > news:u23rUenjDHA.1488@TK2MSFTNGP12.phx.gbl...> > > Andy,
> > >
> > > In that case, instead of a link on the SCR page, you need to redirectof> > the> > > user details page after completing the save from the server-side codepage,> completing> > the> > page,> > > SCR page. Let's say that by the time of the sucessful save in the SCR> > > the user name is stored in a variable named strUserName. After> > > the save and performing any necessary clean-up activity in the SCRwith> page:> > > just use the following line of code to redirect to the user details> > >
> > > Response.Redirect "UserDetails.asp?UserName=" & strUserName
> > >
> > > This will cause a client-side redirection to the user details page,add> > the> > > target user name included in the query string.
> > >
> > > HTH,
> > > Nicole
> > >
> > >
> > >
> > >
> > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > news:3f83bc15$0$125$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > Hi Nicole
> > > >
> > > > There is an add buttin on the SCR form which, when pressed, shouldand> > the> > > > SCR record to the database, then redirect to the userdetails formname> > > check
> > > > the 'username' from the SCR form in the userdetails table, if thebring> > > > exists in a record, bring up that record for updating, otherwiseyou> > up> > > > the form for a new record.
> > > >
> > > > Thanks
> > > >
> > > > Andy G
> > > >
> > > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > > news:eLDtnlOjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > > Andy,
> > > > >
> > > > > I think I may have understood your problem incorrectly. When doaction="userdetails_detail.asp?vusername=vusername <%=GetQueryString("Detail"> the> > > want
> > > > to
> > > > > launch the user details form? From a link on the SCR form? When> code> > Empty,> > > SCR
> > > > > form data is saved? Some other trigger point?
> > > > >
> > > > > Nicole
> > > > >
> > > > >
> > > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > > news:3f82da5f$0$122$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > > Hi Nicole,
> > > > > > Thanks for responding
> > > > > > I am fairly new to ASP and not fully up to speed.
> > > > > >
> > > > > > Currently after the add button is pressed, the followiung is the
> > > submit
> > > > > > code:
> > > > > > <FORM name=frmDetail method=post
> > > > > > action="SCR_detail.asp<%=GetQueryString("Detail", Empty, Empty,> > > > > > Empty)%>">
> > > > > > to follow your convention of <a
> > > > > > href="userdetails.asp?username=whatever">...</a>, I presume the>> >> > > > would
> > > > > > look like this:
> > > > > > <FORM name=frmDetail method=post
> > > > > >
> > > > >
> > > >
> > >new> page> > > > > > , Empty, Empty, Empty, Empty)%>">
> > > > > > where vusername is the variable used on both forms in asp but in
> > > > different
> > > > > > database tables, is this correct?
> > > > > >
> > > > > > Also, what code would be required in the userdetails_detail.asp> > > to
> > > > > > check if the username exists in that table?
> > > > > >
> > > > > > Thanks Again
> > > > > >
> > > > > > Andy G
> > > > > >
> > > > > > "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> > > > > > news:uE58CVNjDHA.2076@TK2MSFTNGP09.phx.gbl...
> > > > > > > Andy,
> > > > > > >
> > > > > > > Put all the logic for determining whether your dealing witha> or> > > > > > existing
> > > > > > > user data in the user details page. In the SCR page, just usethe> > string.> > > link
> > > > to
> > > > > > the
> > > > > > > user details page that passes the SCR user name in the query> > with> > > > > > e.g.:
> > > > > > >
> > > > > > > <a href="userdetails.asp?username=whatever">...</a>
> > > > > > >
> > > > > > > In ther user details page, query the db based for data on the
> > > > specified
> > > > > > > user. If you get back any data, pre-populate all the controls> > > > data
> > > > > > on
> > > > > > > the user. If you don't get back data from the db, leave allthe> > > > > controls
> > > > > > > blank except for the user name (which you can populate withtime> > > value
> > > > > > > received from the query string).
> > > > > > >
> > > > > > > Don't bother flagging the row as an insert or update at thepage> > of> > > > the
> > > > > > > initial read from the db. Even if it's a new row when theadd> is> user> > > > > > initially
> > > > > > > loaded, it might not be by the time it's saved (i.e.: another> > > may
> > > > > > have
> > > > > > > added data against the same user name in the interim). Justa> as> > > logic
> > > > > to
> > > > > > > the code that saves the edited data to the db to update/insert> from> > > > > > necessary
> > > > > > > at the time of the actual save.
> > > > > > >
> > > > > > > HTH,
> > > > > > > Nicole
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > "Vivista Eastbourne" <a@a.a> wrote in message
> > > > > > > news:3f82b41f$0$130$7b0f0fd3@mistral.news.newnet.c o.uk...
> > > > > > > > Hi
> > > > > > > >
> > > > > > > > I have 2 tables, one called SCR and one called userdetails
> > > > > > > > SCR table contains details of a change
> > > > > > > > Userdetails contains information about a user
> > > > > > > >
> > > > > > > > All the data is entered via asp on our intranet
> > > > > > > >
> > > > > > > > One of the SCR fields is Username
> > > > > > > > One of the Userdetails fields is also Username
> > > > > > > >
> > > > > > > > Both tables currently have a seperate asp form (by request> bring> > form> > > > above)
> > > > > > > >
> > > > > > > > How can I check if the value entered for username on the SCR> > > > > exists
> > > > > > > as
> > > > > > > > a username value in the Userdetails form, and if it does,> > up> > > > the
> > > > > > > > record for that username, or if not, open up the blank form.
> > > > > > > >
> > > > > > > > Bear in mind that the forms already exist, just really need
> > > pointers
> > > > > on
> > > > > > > the
> > > > > > > > code.
> > > > > > > >
> > > > > > > > Any help is (as always) greatly appreciated
> > > > > > > >
> > > > > > > > Many Thanks if you can help (you were all newbies once upon>> >> > > time)
> > > > > > > >
> > > > > > > > Andy G
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Vivista Eastbourne Guest



Reply With Quote

