This topic is locked

update record based on dropdownbox

2/24/2009 1:14:34 PM
ASPRunnerPro General questions
M
monye author

in my line in add i'm using a dropdownbox where people can choose existing products and don't have to fil out all fields. what i wan't to do is run sql update statment after save. so that all info is displayed instead of only the choosen field.
does anybody know where to place this small past of asp code?.
this is my code:
<%

set dbConnection = server.CreateObject ("ADODB.Connection")

dbConnection.ConnectionString = strConnection

dbConnection.Open
strSQLUPD1 = "UPDATE [Subinfo Rechtspersonen Natuurlijk Persoon] INNER JOIN ARDTA_CDB0101 ON [Subinfo Rechtspersonen Natuurlijk Persoon].ClientNumber = ARDTA_CDB0101.CUST_F SET [Subinfo Rechtspersonen Natuurlijk Persoon].Initialen = [P1IN_F], [Subinfo Rechtspersonen Natuurlijk Persoon].Tussenvoegsel = [P1MN_F], [Subinfo Rechtspersonen Natuurlijk Persoon].Achternaam = [P1LN_F], [Subinfo Rechtspersonen Natuurlijk Persoon].Adres = [MAAD_F], [Subinfo Rechtspersonen Natuurlijk Persoon].Huisnummer = [MANR_F], [Subinfo Rechtspersonen Natuurlijk Persoon].Postcode = [POCD_F], [Subinfo Rechtspersonen Natuurlijk Persoon].Woonplaats = [TOWN_F], [Subinfo Rechtspersonen Natuurlijk Persoon].Land = [CTRY_F], [Subinfo Rechtspersonen Natuurlijk Persoon].BSN = [SOFI_F] WHERE ((([Subinfo Rechtspersonen Natuurlijk Persoon].ClientNumber) Is Not Null));"

dbConnection.Execute strSQLUPD1
dbConnection.close

set dbConnection = nothing
%>

Sergey Kornilov admin 2/24/2009

If you need to execute this code after record is updated use AfterEdit or AfterAdd event.
I doubt though if you can update JOIN query. Try to update table directly.

M
monye author 2/25/2009

If you need to execute this code after record is updated use AfterEdit or AfterAdd event.

I doubt though if you can update JOIN query. Try to update table directly.


Sergey, the code works, can i found the afteredit and afteradd event in the listpage. sorry to bother you but 5.2 is new for me.
reg,

Peter

Sergey Kornilov admin 2/25/2009

Peter,
you need to elaborate your question.
I'm not sure how list page and record editing are related.

M
monye author 2/26/2009

i do add and edit via Inline Add and Inline Edit on the list page. Then i choose a value from a dropdown. and the after save i wan't to run sql statement that fills in rest of fields for that specific record auromaticily. and shows them.

Sergey Kornilov admin 2/27/2009

Peter,
I see what you saying.
Use BeforeEdit/BeforeAdd events that belong to Edit/Add pages respectively.