Updating a record in the table in asp

Updating a record in the table in asp

am 27.06.2007 16:10:59 von bhavnabakshi

Hi,

I would like to update the record when user clicks on a button. Update
should be done on person_id. XSL is calling asp to update the record.
For some reason, it's not picking up the correct person id. Below is
the code.
Any help is appreciated.

TIA,
Bhavna

In the xsl page i am passing person_id hidden



xsl:attribute>

>



In asp i am retrieving person id and updating the record if user
clicks on the button
if strConfEmail= "ConfEmail" then
strSQL = "Update Orders SET confirmation_date_time = null,
EMS_Message_id='' where BT_ID = " & strPersonId & " and order_number =
'" & xslEncode(rsAFM("order_number")) & "'"
conn.execute strSQL
end if

Re: Updating a record in the table in asp

am 28.06.2007 10:09:01 von Anthony Jones

"Bhavna" wrote in message
news:1182953459.338086.291580@o61g2000hsh.googlegroups.com.. .
> Hi,
>
> I would like to update the record when user clicks on a button. Update
> should be done on person_id. XSL is calling asp to update the record.
> For some reason, it's not picking up the correct person id. Below is
> the code.
> Any help is appreciated.
>
> TIA,
> Bhavna
>
> In the xsl page i am passing person_id hidden
>
>
>
> > xsl:attribute>
>
> > >
>

>
>
> In asp i am retrieving person id and updating the record if user
> clicks on the button
> if strConfEmail= "ConfEmail" then
> strSQL = "Update Orders SET confirmation_date_time = null,
> EMS_Message_id='' where BT_ID = " & strPersonId & " and order_number =
> '" & xslEncode(rsAFM("order_number")) & "'"
> conn.execute strSQL
> end if
>

Not really enough to go on here,

If you do a View source on the page resulting from the XSL does the hidden
input have the expected value. If not then the problem is with your XSL.

If it does then we need to see how the value of strPersonId is assigned?
Also what does AskDelete() actually do?
Replace conn.execute strSQL with Response.Write strSQL. You can then see if
the SQL you expect is realy being built. However you should note that
building SQL like this makes you code vunerable to SQL Injection attack.

Re: Updating a record in the table in asp

am 02.07.2007 18:25:30 von bhavnabakshi

On Jun 28, 4:09 am, "Anthony Jones" wrote:
> "Bhavna" wrote in message
>
> news:1182953459.338086.291580@o61g2000hsh.googlegroups.com.. .
>
>
>
>
>
> > Hi,
>
> > I would like to update the record when user clicks on a button. Update
> > should be done on person_id. XSL is calling asp to update the record.
> > For some reason, it's not picking up the correct person id. Below is
> > the code.
> > Any help is appreciated.
>
> > TIA,
> > Bhavna
>
> > In the xsl page i am passing person_id hidden
> >
> >
> >
> > > > xsl:attribute>
> >
> > >
> >

> >
>
> > In asp i am retrieving person id and updating the record if user
> > clicks on the button
> > if strConfEmail= "ConfEmail" then
> > strSQL = "Update Orders SET confirmation_date_time = null,
> > EMS_Message_id='' where BT_ID = " & strPersonId & " and order_number =
> > '" & xslEncode(rsAFM("order_number")) & "'"
> > conn.execute strSQL
> > end if
>
> Not really enough to go on here,
>
> If you do a View source on the page resulting from the XSL does the hidden
> input have the expected value. If not then the problem is with your XSL.
>
> If it does then we need to see how the value of strPersonId is assigned?
> Also what does AskDelete() actually do?
> Replace conn.execute strSQL with Response.Write strSQL. You can then see if
> the SQL you expect is realy being built. However you should note that
> building SQL like this makes you code vunerable to SQL Injection attack.- Hide quoted text -
>
> - Show quoted text -

Yeah, the hidden value is showing me the expected value. But, when I
am passing it in AskDelete function it gives me all the personid on
that page. Instead of giving the personid I clicked for e.g. when I
do view source I get this:
name="personid11" value="200138906"> name="imgEmailConfirm" src="/images/EmailConfirm.gif"
Language="javascript" onclick="return AskDelete(personid11)">
AskDelete is confirming a change and passing the personid to another
function
function ChangeMode(iPersonid){
document.frmMeetings.ConfEmail.value = 'ConfEmail';
alert(iPersonid);
document.frmMeetings.personid11.value = iPersonid;
document.frmMeetings.submit();
}

function AskDelete(personid11){
var Decision = window.confirm('An email confirmation will be sent
with the next scheduled batch job.');
if (Decision)
ChangeMode(iPersonid);
else
return false;
}
In asp I am retrieving personid by using request object

strPersonId = Request("personid11")
Response.Write strPersonId

Thanks in Advance,
Bhavna

Re: Updating a record in the table in asp

am 03.07.2007 10:54:32 von Anthony Jones

"Bhavna" wrote in message
news:1183393530.052773.121870@g4g2000hsf.googlegroups.com...
> On Jun 28, 4:09 am, "Anthony Jones" wrote:
> > "Bhavna" wrote in message
> >
> > news:1182953459.338086.291580@o61g2000hsh.googlegroups.com.. .
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > I would like to update the record when user clicks on a button. Update
> > > should be done on person_id. XSL is calling asp to update the record.
> > > For some reason, it's not picking up the correct person id. Below is
> > > the code.
> > > Any help is appreciated.
> >
> > > TIA,
> > > Bhavna
> >
> > > In the xsl page i am passing person_id hidden
> > >
> > >
> > >
> > > > > > xsl:attribute>
> > >
> > > > >
> > >

> > >
> >
> > > In asp i am retrieving person id and updating the record if user
> > > clicks on the button
> > > if strConfEmail= "ConfEmail" then
> > > strSQL = "Update Orders SET confirmation_date_time = null,
> > > EMS_Message_id='' where BT_ID = " & strPersonId & " and order_number =
> > > '" & xslEncode(rsAFM("order_number")) & "'"
> > > conn.execute strSQL
> > > end if
> >
> > Not really enough to go on here,
> >
> > If you do a View source on the page resulting from the XSL does the
hidden
> > input have the expected value. If not then the problem is with your
XSL.
> >
> > If it does then we need to see how the value of strPersonId is assigned?
> > Also what does AskDelete() actually do?
> > Replace conn.execute strSQL with Response.Write strSQL. You can then
see if
> > the SQL you expect is realy being built. However you should note that
> > building SQL like this makes you code vunerable to SQL Injection
attack.- Hide quoted text -
> >
> > - Show quoted text -
>
> Yeah, the hidden value is showing me the expected value. But, when I
> am passing it in AskDelete function it gives me all the personid on
> that page. Instead of giving the personid I clicked for e.g. when I
> do view source I get this:
> > name="personid11" value="200138906"> > name="imgEmailConfirm" src="/images/EmailConfirm.gif"
> Language="javascript" onclick="return AskDelete(personid11)">
> AskDelete is confirming a change and passing the personid to another
> function
> function ChangeMode(iPersonid){
> document.frmMeetings.ConfEmail.value = 'ConfEmail';
> alert(iPersonid);
> document.frmMeetings.personid11.value = iPersonid;
> document.frmMeetings.submit();
> }
>
> function AskDelete(personid11){
> var Decision = window.confirm('An email confirmation will be sent
> with the next scheduled batch job.');
> if (Decision)
> ChangeMode(iPersonid);
> else
> return false;
> }
> In asp I am retrieving personid by using request object
>
> strPersonId = Request("personid11")
> Response.Write strPersonId
>
> Thanks in Advance,
> Bhavna
>

When you submit a form that form will post up all its fields. It has no way
to know you have an intended context and there is no way to post up only
some of the fields.

A solution that involves minimul changes to your code is to use a hidden
form:-







Your TD should look something like this:-


onclick="AskDelete.call(this)" />


(Note the style attributes removed from TD for clarity, you could add them
to your the CSS selector td.text2)

Now the AskDelete function can move the appropriate value to the form:-

document.frmMeetings.PersonID.value =
this.parentNode.getAttribute("personID")

Creating lots of names and ids in a table (or anywhere in HTML) is often a
sign that things are going off the rails.
Using the 'this' context values can be retrieved from relatives eliminating
the need to give everything in sight an id and a name.

Anthony