[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

refresh the called form when move the cursor to another record

Gary

10/19/2005 10:41:00 AM

HI

There are two From, Form A and Form B.

There is a button created on Form A which Call and pass the parameter Form
B. Form B will use the parameter value to filter record in executeQueary
method.

Any method to do that if Form A move the cursor to other record in grid, the
Form B get the new parameter value to filter record and refresh Form B data
grid.

Gary
9 Answers

Gary

10/19/2005 10:54:00 AM

0

Hi

This case just like when I open Item Master and click onhand. When I move
the cursor to another record in Item Master, The onhand table can be update
automatically.

"Gary" wrote:

> HI
>
> There are two From, Form A and Form B.
>
> There is a button created on Form A which Call and pass the parameter Form
> B. Form B will use the parameter value to filter record in executeQueary
> method.
>
> Any method to do that if Form A move the cursor to other record in grid, the
> Form B get the new parameter value to filter record and refresh Form B data
> grid.
>
> Gary

Bob Barrows [MVP]

11/25/2008 8:10:00 PM

0

MikeR wrote:
> Hi Bob - Now this is SERVICE. Thanks.
>
> Bob Barrows wrote:
>> MikeR wrote:
>>> I'm working on my first site using parameterized queries. I can't
>>> find how to handle the fields for an INSERT, UPDATE or DELETE when
>>> the values have an apostrophe, comma, or quote in them. i.e:
>>>
>>> str2qry = "qry_Update_Sta " & request.form("LastName") & ", " & _
>>> request.form("Height") & ", " &
>>
>> This is not a parameterized query. It's basic dynamic sql. You need
>> to pass the values as parameters, like this:
>>
>> Aconn.qry_Update_Sta request.form("LastName"), _
>> request.form("Height")
>
> ADODB.Connection (0x800A0E7C)
> Parameter object is improperly defined. Inconsistent or incomplete
> information was provided.
> /nf4l/dir1/asp/updateDB_Action.asp, line 49
>
> AConn.qry_Update_Sta request.form("AdminCall"),
> request.form("tower"), _ request.form("160M"), request.form("80M"),
> request.form("40M"), _ request.form("20M"), request.form("15M"),
> request.form("10M"), _ request.form("RxA"), request.form("Rig"),
> request.form("Amp"), _ request.form("App"), request.form("EMail"),
> request.form("club"), _ request.form("QTH"), request.form("URL"),
> request.form("comment"), _ request.form("KeyCall")

ok, you passed 18 values

>
> The query is:
> UPDATE Stations SET Call = [StaCall], Towers = [tower], M160 =
> [160M], M80 = [80M], M40 = [40M], M20 = [20M], M15 = [15M], M10 =
> [10M], RXAntennas = [RxA], Rigs = [Rig], AMPS = [AMP], ContestSW =
> [App], [E-Mail] = [Email], ContestClub = [Club], Location = [QTH],
> WebPage = [URL], Comments = [Comment], Updated = Date()
> WHERE call=[UCALL];

and the query expects (if those are all being treated as parameters) ...
17? Let's make sure:

1 [StaCall]
2 [tower]
3 [160M]
4 [80M]
5 [40M]
6 [20M]
7 [15M]
8 [10M]
9 [RxA]
10 [Rig]
11 [AMP]
12 [App]
13 [Email]
14 [Club]
15 [QTH]
16 [URL] I'm wondering if URL is a reserved keyword
17 [Comment]
Date() not a parameter
18 [UCALL]

Nope, I miscounted. So the parameters expected match the values
supplied.

>
Kinda tough to debug this one from where I'm sitting, but the first
thing to do is to make sure none of those parameters have the same name
as a database object (or reserved keyword) by prefixing them with a "p"
(that's the technique i use - you may do whatever you like to achieve
the same result):
UPDATE Stations SET Call = [pStaCall], Towers = [ptower], ...

Also, a couple of those field names look suspect, so you might want to
enclose them with brackets as well.

Now run the query in Access and keep track of the order in which you are
prompted for parameter values: that will be the same order in which you
will need to supply them in the vbscript code.

Next, make sure your request form variables contain what you expect them
to contain. I prefer to assign the values to local variables and
validate the local variables.

--
HTH,
Bob Barrows


MikeR

11/26/2008 6:46:00 PM

0

Bob Barrows wrote:
> MikeR wrote:
>> Hi Bob - Now this is SERVICE. Thanks.
>>
>> Bob Barrows wrote:
>>> MikeR wrote:
>>>> I'm working on my first site using parameterized queries. I can't
>>>> find how to handle the fields for an INSERT, UPDATE or DELETE when
>>>> the values have an apostrophe, comma, or quote in them. i.e:
>>>>
>>>> str2qry = "qry_Update_Sta " & request.form("LastName") & ", " & _
>>>> request.form("Height") & ", " &
>>> This is not a parameterized query. It's basic dynamic sql. You need
>>> to pass the values as parameters, like this:
>>>
>>> Aconn.qry_Update_Sta request.form("LastName"), _
>>> request.form("Height")
>> ADODB.Connection (0x800A0E7C)
>> Parameter object is improperly defined. Inconsistent or incomplete
>> information was provided.
>> /nf4l/dir1/asp/updateDB_Action.asp, line 49
>>
>> AConn.qry_Update_Sta request.form("AdminCall"),
>> request.form("tower"), _ request.form("160M"), request.form("80M"),
>> request.form("40M"), _ request.form("20M"), request.form("15M"),
>> request.form("10M"), _ request.form("RxA"), request.form("Rig"),
>> request.form("Amp"), _ request.form("App"), request.form("EMail"),
>> request.form("club"), _ request.form("QTH"), request.form("URL"),
>> request.form("comment"), _ request.form("KeyCall")
>
> ok, you passed 18 values
>
>> The query is:
>> UPDATE Stations SET Call = [StaCall], Towers = [tower], M160 =
>> [160M], M80 = [80M], M40 = [40M], M20 = [20M], M15 = [15M], M10 =
>> [10M], RXAntennas = [RxA], Rigs = [Rig], AMPS = [AMP], ContestSW =
>> [App], [E-Mail] = [Email], ContestClub = [Club], Location = [QTH],
>> WebPage = [URL], Comments = [Comment], Updated = Date()
>> WHERE call=[UCALL];
>
> and the query expects (if those are all being treated as parameters) ...
> 17? Let's make sure:
>
> 1 [StaCall]
> 2 [tower]
> 3 [160M]
> 4 [80M]
> 5 [40M]
> 6 [20M]
> 7 [15M]
> 8 [10M]
> 9 [RxA]
> 10 [Rig]
> 11 [AMP]
> 12 [App]
> 13 [Email]
> 14 [Club]
> 15 [QTH]
> 16 [URL] I'm wondering if URL is a reserved keyword
> 17 [Comment]
> Date() not a parameter
> 18 [UCALL]
>
> Nope, I miscounted. So the parameters expected match the values
> supplied.
>
> Kinda tough to debug this one from where I'm sitting, but the first
> thing to do is to make sure none of those parameters have the same name
> as a database object (or reserved keyword) by prefixing them with a "p"
> (that's the technique i use - you may do whatever you like to achieve
> the same result):
> UPDATE Stations SET Call = [pStaCall], Towers = [ptower], ...
Done.
>
> Also, a couple of those field names look suspect, so you might want to
> enclose them with brackets as well.
All in brackets.
>
> Now run the query in Access and keep track of the order in which you are
> prompted for parameter values: that will be the same order in which you
> will need to supply them in the vbscript code.
Done. The record updated in Access. The only thing that would cough on the order is
the date, right? All the rest of the fields are text.
>
> Next, make sure your request form variables contain what you expect them
> to contain. I prefer to assign the values to local variables and
> validate the local variables.

I had the wrong names for some of the request.form variables, so a value of blank
(space or NULL?) was being sent to the query. After I fixed that, the DB updates
(assuming all the fields have a value)

To discover that, I iterated thru the forms collection. As a matter of curiosity, why
don't they appear in the same order as they are on the form that sends them?

Some of the variables may not contain a value, I'd want to set that field in the DB
to blank (or NULL). Do I need an Iif in the query in that case? Or?

Bob Barrows [MVP]

11/26/2008 7:29:00 PM

0

MikeR wrote:
> I had the wrong names for some of the request.form variables, so a
> value of blank (space or NULL?) was being sent to the query. After I
> fixed that, the DB updates (assuming all the fields have a value)
>
> To discover that, I iterated thru the forms collection. As a matter
> of curiosity, why don't they appear in the same order as they are on
> the form that sends them?

There is nothing that says they have to. Each browser is free to do it the
way it wants to.

>
> Some of the variables may not contain a value, I'd want to set that
> field in the DB to blank (or NULL). Do I need an Iif in the query in
> that case? Or?

or validate the data and, if a variable is empty, set it to null before
passing its value to the database.

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


MikeR

11/26/2008 9:55:00 PM

0

Bob Barrows wrote:
> MikeR wrote:
>> I had the wrong names for some of the request.form variables, so a
>> value of blank (space or NULL?) was being sent to the query. After I
>> fixed that, the DB updates (assuming all the fields have a value)
>>
>> To discover that, I iterated thru the forms collection. As a matter
>> of curiosity, why don't they appear in the same order as they are on
>> the form that sends them?
>
> There is nothing that says they have to. Each browser is free to do it the
> way it wants to.
>
>> Some of the variables may not contain a value, I'd want to set that
>> field in the DB to blank (or NULL). Do I need an Iif in the query in
>> that case? Or?
>
> or validate the data and, if a variable is empty, set it to null before
> passing its value to the database.

Great! Thanks, Bob.
Have a great Thanksgiving.

Adrienne

11/27/2008 7:40:00 PM

0

Gazing into my crystal ball I observed MikeR <nf4lNoSpam@pobox.com>
writing in news:edxtuc$TJHA.592@TK2MSFTNGP04.phx.gbl:

> Some of the variables may not contain a value, I'd want to set that
> field in the DB to blank (or NULL). Do I need an Iif in the query in
> that case? Or?
>

I always check variables coming from a form before posting them to a db.
That way if the user forgot a field, or has put in an invalid value (like
only 4 characters in a 5 character zipcode), you can give the user a chance
to fix it. Don't rely on client side script for this - use client side
script to do a cursory check, but always validate on the server.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-c...
Please respond to the group so others can share

(Evertjan)

11/27/2008 8:25:00 PM

0

Adrienne Boswell wrote on 27 nov 2008 in
microsoft.public.inetserver.asp.db:

> I always check variables coming from a form before posting them to a
> db. That way if the user forgot a field, or has put in an invalid
> value (like only 4 characters in a 5 character zipcode), you can give
> the user a chance to fix it. Don't rely on client side script for
> this - use client side script to do a cursory check, but always
> validate on the server.
>

The nice thing with ASP is,
that you cn use exactly the same worded validating function
in javascript both serverside and clientside,
even if you are using serverside vbs mainly:

<% 'vbs
if validate(request.form("formfieldresult")) then
...
%>

<script type='text/javascript'> // for use in onsubmit
function validate(x){
....
return boolean;
};
</script>
<script language='javascript' runat='server'> // serverside
function validate(x){
....
return boolean;
};
</script>



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

MikeR

11/28/2008 11:49:00 AM

0

Adrienne Boswell wrote:
> Gazing into my crystal ball I observed MikeR <nf4lNoSpam@pobox.com>
> writing in news:edxtuc$TJHA.592@TK2MSFTNGP04.phx.gbl:
>
>> Some of the variables may not contain a value, I'd want to set that
>> field in the DB to blank (or NULL). Do I need an Iif in the query in
>> that case? Or?
>>
>
> I always check variables coming from a form before posting them to a db.
> That way if the user forgot a field, or has put in an invalid value (like
> only 4 characters in a 5 character zipcode), you can give the user a chance
> to fix it. Don't rely on client side script for this - use client side
> script to do a cursory check, but always validate on the server.
>
Good point. Thanks.

MikeR

11/28/2008 11:51:00 AM

0

Evertjan. wrote:
> Adrienne Boswell wrote on 27 nov 2008 in
> microsoft.public.inetserver.asp.db:
>
>> I always check variables coming from a form before posting them to a
>> db. That way if the user forgot a field, or has put in an invalid
>> value (like only 4 characters in a 5 character zipcode), you can give
>> the user a chance to fix it. Don't rely on client side script for
>> this - use client side script to do a cursory check, but always
>> validate on the server.
>>
>
> The nice thing with ASP is,
> that you cn use exactly the same worded validating function
> in javascript both serverside and clientside,
> even if you are using serverside vbs mainly:
>
> <% 'vbs
> if validate(request.form("formfieldresult")) then
> ...
> %>
>
> <script type='text/javascript'> // for use in onsubmit
> function validate(x){
> ....
> return boolean;
> };
> </script>
> <script language='javascript' runat='server'> // serverside
> function validate(x){
> ....
> return boolean;
> };
> </script>
>
>
>
Nice tip. Thanks.