Jeditable and Classic ASP

This week I implemented a grid style application using Classic ASP and Jeditable. The hardest part of implementing this application was trying to figure out what a save.asp version of save.php would look like. Here the template I created.

 
<% 
dim sID, sValue,errorcode dim field1,field2,field3,field4 
'The sID is a spreadsheet style ID 
'As an example B3 would be the second editable field 
'for DB ID field = 3
sID = request("id") 
sValue = request("value") 
sType = mid(sID,1,1) 
sDataID = mid(sID,2)  
'We have four editable fields 
'The changed field will not be null 
field1 = null 
field2 = null 
field3 = null 
field4 = null 
errorcode = 0  
select case sType 
case "A" 	
field1 = sValue 
case "B" 	
field2 = sValue 
case "C" 	
field3 = sValue 
case "D" 	
field4 = sValue 
case else 	
errorcode = 1 
end select 
if errorcode = 0 then 
'Validate and update the data base 
end if 
if errorcode = 0 then 
'Send back the value field 
Response.Write sValue 
else  
Response.Write "<b>!Error " & errorcode & "</b>" 
end if 
%>