This topic is locked

How to use event tab

8/9/2006 2:40:53 PM
ASPRunnerPro General questions
Corinne author

Hi,
I'm having a hard time trying to use the events tab in ASPRunner
I'm using the newest version of ASP Runner and connecting to SQL database.
4 tables:

Customers

OrderHeader

OrderDetail

AttentionReasons
Heres the query to connect them all:
SELECT opCustomer.CustName, opOrdDtl.PO, opOrdDtl.Model, opOrdHdr.ENTER_DATE, sordAttentionReasons.Attention, opOrdDtl.SO,

opOrdDtl.ID

FROM opCustomer RIGHT OUTER JOIN

opOrdHdr ON opCustomer.CustId = opOrdHdr.CustID RIGHT OUTER JOIN

opOrdDtl LEFT OUTER JOIN

sordAttentionReasons ON opOrdDtl.ID = sordAttentionReasons.OrdDtlID ON opOrdHdr.SO = opOrdDtl.SO
This runs just fine and brings me back the expected result set. The user then uses the advanced search feature and can find the specific record they wish to edit & hit edit to bring them to the edit screen. Once the user edits the record & hits save I get all kinds of errors.
I put this code in OrderDetail After Edit: (Is this where it should go or should it be sordAttentionReasons AfterEdit?????
How do I have it pick up the values (Attention & ID) for the fields (Attention & OrdDtlID) I want to insert in sordAttentionReasons table?????
Sub AfterEdit()

'** Insert a record into another table ****

strSQLInsert = "insert into sordAttentionReasons (Attention, OrdDtlID) values (Attention, ID)"

dbConnection.Execute strSQLInsert
End Sub
This is the error I'm receiving:
Error Type:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E23)

[Microsoft][ODBC SQL Server Driver]Cursor operation conflict

/Comments3/opOrdDtl_edit.asp, line 150
I did NOT create parent / child relationship in ASP Runner between these tables - should I do that? The relationships are already set in the database structure.
Can anyone pleae help me with this? I've already spent way too much time trying to get something this simple to work.
I've looked all over for some samples of how to use the events tab in ASP Runner and can not find any samples. Everythng I find seems to be just single lines of code with no explanination of where to put it.
Thanks,

Corinne

R
Rhoffman 8/10/2006

Try this:
var1=rs("Attention")

var2=rs('OrdDtlID")
strSQLInsert = "insert into sordAttentionReasons (Attention, OrdDtlID) values (" & var1 & "," & var2 & "Attention, ID)"

J
Jane 8/11/2006

Hi,
use BeforeEdit event for your purpose.
Here is correct event code for OrderDetail table:

Function BeforeEdit(dict, where)

'********** Insert a record into another table ************
strSQLInsert = "insert into sordAttentionReasons (Attention, OrdDtlID) values ('" & dict("Attention") & "'," & dict("ID") & ")"

dbConnection.Execute strSQLInsert
BeforeEdit = True
End Sub