RE: Problem in using trigger
From: John Bell (JohnBell_at_discussions.microsoft.com)
Date: 09/14/04
- Next message: John Bell: "RE: How to access a local text file from SP on remote database."
- Previous message: Daryl: "Re: GROUP BY HAVING"
- In reply to: Sridhar K: "Problem in using trigger"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 14 Sep 2004 00:27:14 -0700
Hi
You don't give the code for the trigger therefore it is not possible to see
what would be happening. If you posted DDL (Create table, Create Trigger
etc...) statements it would be alot cleared along with example data (as
insert statements) See http://www.aspfaq.com/etiquette.asp?id=5006 for
information regarding doing this.
You may want to consider using a stored procedure to provide this
functionality and encapsulate the logic so the work is performed on the
server.
The requery method will refresh a record set. Your AutoRs recordset does not
have any parameters therefore you are not being product specific. Also SELECT
* is not deemed as good coding for a production environment.
HTH
John
"Sridhar K" wrote:
> Dear All,
>
> I am facing problem in using the "TRIGGER"
>
> There are 2 tables.
>
> Ex
> Table 1
> Table 2 - (Insert Trigger written in this table)
>
> I am getting some value from previous page(asp)
>
> Following is my code structure
> ========================
> <%
> Set ProductRs = Myconn.execute("Select VFld1 from Table1")
> If Not ProductRs.Eof Then
> Fld1 = ProductRs("VFld1") + Request.Form("User_Value")
> Set AutoRs = Myconn.execute("Select * from Table2")
> If Not AutoRs.eof then
> Response.Write "Info not matching. Try again"
> End If
> If AutoRs.eof then
> MyConn.Execute("Update Table1 Set Fld1 = " & VFld1 & ", Fld2 =
> '"&VFld2&"' where Prd_Sl_no=" &VFld3&"")
> Myconn.execute("insert into Table2(sFld1,sfld2,sfld3)
> values("&VsFld1&",'"&VsFld2&"','"&VsFld3&"')")
> End If
> End If
> %>
>
> Step 1
> ====
> I am creating a record set called "ProductRs" with "Table 1"
> Here The ProductRs("VFld1") = 3000
> Step 2
> ====
> Here the the Request.Form("User_Value") = 2000
> Adding user value to the VFld1 of the record set "ProductRs"
> Let say The Total is 5000
>
> Step 3
> ====
> Here i am creating another record set which is "AutoRs"
> Which is currently EOF
>
> Now my problem is.
>
> Since the AutoRs is eof
>
> The update and the insert statments are executed.
>
> But after this process the "If Not AutoRs.eof Then " statment also
> executed. and more then that now the ProductRs("VFld1") = 5000.
>
> But i am not executed the "ProductRs" agin.
>
> Earlier the ProductRs("VFld1") = 3000
> Now the ProductRs("VFld1") = 5000
>
> Like that
>
> Earlier AutoRs is eof
>
> Now it is Not AutoRs eof
>
> I Mean to say both(all) the statments are executed.
>
> Give me a solution.
>
> Regards
> Sridhar K
> Chennai - India
>
>
>
>
- Next message: John Bell: "RE: How to access a local text file from SP on remote database."
- Previous message: Daryl: "Re: GROUP BY HAVING"
- In reply to: Sridhar K: "Problem in using trigger"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|