Superkikim
|
| Posted: 08/26/2002, 12:45 PM |
|
Working in ASP with CCS 1.0.7
I'm making a forum. On new POST or new REPLY, a mail MUST be sent to the administrator for control. In this mail, I want the content of the new post, and a link to the answer form (i.e. http://www.domain.com/forum/answer.asp?parent_id=12)
To do that I must retrieve the last ID.
I tried to do it through CCOpenRS in Event "After Insert". But it doesn't work. The field is not found, but it exists ! So if you can give me an example of retriving last ID field with ASP and MS-Access in CCS, I would very appreciate
|
|
|
 |
Nicole
|
| Posted: 08/28/2002, 12:27 AM |
|
Superkikim,
please refer to the gotocode article: http://www.gotocode.com/art.asp?art_id=80&
The same concept could be used in CCS. Here is the code snippet with CCS syntax:
last = CCDLookUp("id_field_name", "table_name", " title= " & CCToSQL(fom_name.titale.Value, ccsText))
"select ID_Fieldname from table_name where title = " & ToSQL(fldtitle, "Text")
Redirect = Redirect & "&lastpk=" & last
'or create a session variable to hold the value
Session("lastpk") = last
|
|
|
 |
Superkikim
|
| Posted: 08/30/2002, 4:43 PM |
|
Thank you Nicole. In between I've understood how it works.
Here is an example
Dim conn
Dim idrs
Dim idsql
dim msgtocheck
Set conn = new clsDBconnection_name
conn.Open
dim cond
cond=" where message_title= " & CCToSQL(messages.title.Text, ccsText) & " and author=" & CCToSQL(messages.author.Text, ccsText) & " and email=" & CCToSQL(messages.email.Text, ccsText) & " and date_add=" & CCToSQL(messages.Date_Add.Value, ccsDate) & ";"
idSQL = "select * from forum_messages" & cond
CCOpenRS idrs,idsql,conn,true
msgtocheck=CCGetValue(idrs,"message_id")
set idrs=nothing
conn.Close
Set conn = Nothing
|
|
|
 |
|