nicolewyp
asked on
Update database when a certain link is click
how do i update the database when a user login to my web site and click on certain link using ASP?
for example, on my web site, there is LinkA and LinkB. when userA login and click on LinkA, i need to update the database table called tblLink with the user name (i.e., userA) and the linkage (i.e., LinkA or LinkB).
thank you.
for example, on my web site, there is LinkA and LinkB. when userA login and click on LinkA, i need to update the database table called tblLink with the user name (i.e., userA) and the linkage (i.e., LinkA or LinkB).
thank you.
ASKER
dear carlosMu, thank you for your comment. however, your suggestion cannot be apply to my situation because the LinkA and LinkB do not link to another page. Instead it link to a zip file. therefore i cannot use the SQL insert method after the link is click. is it possible the update is done when the link is click?
ASKER
dear carlosMu, thank you for your comment. however, your suggestion cannot be apply to my situation because the LinkA and LinkB do not link to another page. Instead it link to a zip file. therefore i cannot use the SQL insert method after the link is click. is it possible the update is done when the link is click?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Recommendation: Accept comment from CarlosMu
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
DominicCronin
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Recommendation: Accept comment from CarlosMu
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
DominicCronin
EE Cleanup Volunteer
' First you capture the user id on the form that answers
' to the Login form
DIM strUserid
strUser = Resquest.Form("UserId")
' Store the user id on a cookie
Response.cookies("UserId")
'Redirect to the form were the choice is made
Response.redirect("choice.
The choice.html doesnt have to be anything more than a page where the links are available
On the LInkA.ASP page on the other hand, you obtain the user entered on the login and create the apropiated insert Statment
dim strUserId
dim cn
dim cnStr
dim strSql 'SQL STRING
' Please remember it is case sensitive
strUserId = Request.cookies("UserId")
cnStr = "Wharever your conection string is"
set cn = server.CreateObject("ADODB
strSQL = "INSERT INTO tblLink (USERID, LINKAGE, "
strSql = strSql & "EVENTDATE,OTHER FIELD) VALUES ("
'Single apost are used inside double quotes becuse user id is a string
strSql = strSql & "'" & strUserId & "', "
'Since this is a sample for LinkA.asp page ....
strSql = strSql & "'LINKA.ASP', " & "'" & NOW() & "', "
'you continue this way until you fill all the fields
'Remebmer to close the parentesis
strSql = strSql & ")"
cn.Open cnStr, strSql