Below is an extract from my code..

1) insert code works fine, then..
2) retrieves inserted record ID
3) then it SHOULD update the status of the performance with "booked"

But it doesnt seem to update..

any ideas?

<%

sql="INSERT INTO bookings (performanceID, customerID, bookingDate)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("performanceID") & "',"
sql=sql & "'" & Request.Form("customerID") & "',"
sql=sql & "'" & Request.Form("bookingDate") & "')"

'on error resume next
conn.Execute sql,recaffected 

'debug the sql statement
response.write sql

'create a new recordset to hold the new data, as we need to run a seperate query to find the bookingID

set rs2 = Server.CreateObject("ADODB.recordset")
sql2 = "SELECT @@Identity"
set rs2 = conn.execute(sql2)
bookingID = "Your Booking Number is: " & rs2(0)
response.write rs2(0)

sql3=sql3 = "UPDATE performances SET Status=booked WHERE performanceID='" & performanceID &"'"
'on error resume next
conn.Execute sql3,recaffected 

%>

Hope you can help me with my syntax..

Are you sure you want
sql3=sql3 = "UPDATE performances SET Status=booked WHERE performanceID='" & performanceID &"'"
OR
sql3= "UPDATE performances SET Status=booked WHERE performanceID='" & performanceID &"'"

Can you check and revert if that fixed it for you?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.