If Request.Form("ticker").count > 0 ഀ
then set Session("webRd") = ഀ
Server.CreateObject("ADODB.RECORDSET") ഀ
Session("webRd").ActiveConnection = ഀ
Session("webConn") ഀ
Session("webRd").CursorLocation = 3 ഀ
Session("webRd").CursorType = 2 ഀ
Session("webRd").LockType = 2 ഀ
Session("webRd").Source = "SELECT * FROM " & ഀ
Request.Form("ticker") ഀ
Session("webRd").Open End If
set RS = Session("webRd")
mode = ഀ
CInt( Request.QueryString("mode") ) If mode = 1 ഀ
then direction = CInt( ഀ
Request.QueryString("direction") )
select ഀ
case direction case ഀ
1: If not RS.Eof ഀ
or not RS.Bof ഀ
then ഀ
RS.MoveFirst End ഀ
If case 2: ഀ
If not RS.BOF ഀ
Then ഀ
RS.MovePrevious ഀ
mvPrev = true End ഀ
If case ഀ
3: If not RS.EOF ഀ
Then ഀ
RS.MoveNext ഀ
mvNext = true ഀ
End If case ഀ
4: If not RS.Eof ഀ
or not RS.Bof ഀ
then ഀ
RS.MoveLast End ഀ
If end ഀ
select
'Error Handling ഀ
If not RS.BOF or not RS.EOF ഀ
then If RS.EOF ഀ
and mvNext Then ഀ
RS.MoveLast ഀ
elseif RS.EOF ഀ
then ഀ
RS.Requery End ഀ
If
If RS.BOF ഀ
and mvPrev Then ഀ
RS.MoveFirst ഀ
elseif RS.BOF ഀ
then ഀ
RS.Requery End ഀ
If End If elseif mode = 2 ഀ
then 'get edit information : ഀ
Insert,Update,Delete or Cancel operate = CInt( ഀ
Request.QueryString("operate") )
select ഀ
case operate case 2: ഀ
'Delete If ഀ
RS.RecordCount > 0 ഀ
then ഀ
RS.Delete ഀ
'RS.MoveNext ഀ
RS.MovePrevious ഀ
if RS.RecordCount > 0 and RS.BOF ഀ
then ഀ
RS.MoveFirst ഀ
end if End ഀ
If case 3: ഀ
'Update if not ഀ
RS.EOF and not RS.EOF ഀ
then ഀ
for i = 0 to RS.Fields.Count - 1 on error ഀ
resume ഀ
next
ഀ
fdType = ഀ
RS(i).type ഀ
if IsNull(RS(i).value) ഀ
then ഀ
fdValue = ഀ
"" ഀ
else ഀ
fdValue = ഀ
RS(i).value ഀ
end ഀ
if
ഀ
name = "S" & ഀ
CStr(i) ഀ
txtVal = ഀ
Request.Form(name) ഀ
if IsNull(txtVal) or IsEmpty(txtVal) ഀ
then ഀ
txtVal = ഀ
"" ഀ
end ഀ
if
ഀ
if Server.URLEnCode(txtVal) <> Server.URLEnCode(fdValue) ഀ
then ഀ
if Len(txtVal) = 0 ഀ
then ഀ
RS(i) = ഀ
null ഀ
else ഀ
select case ഀ
fdType ഀ
case 16, 2, 3, 20, 17, 18, 19, 21, 4, 5, 6, 14, 131, ഀ
11 ഀ
if IsNumeric(txtVal) ഀ
then ഀ
RS(i) = ഀ
txtVal ഀ
else ഀ
bErr = ഀ
true ഀ
msgErr = fdName & " must be a numeric data. Please go ഀ
back." ഀ
end ഀ
if ഀ
case ഀ
else ഀ
RS(i) = ഀ
txtVal ഀ
end ഀ
select ഀ
end ഀ
if ഀ
end ഀ
if ഀ
next ഀ
if bErr = false ഀ
then ഀ
RS.Update ഀ
end ഀ
if ഀ
on error goto 0 ഀ
end if case 5: 'Update for ഀ
addnew on error resume ഀ
next
ഀ
RS.AddNew for i ഀ
= 0 to RS.Fields.Count - ഀ
1 ഀ
fdType = ഀ
RS(i).type
ഀ
name = "S" & ഀ
CStr(i) ഀ
txtVal = ഀ
Request.Form(name) ഀ
if IsNull(txtVal) or IsEmpty(txtVal) ഀ
then ഀ
txtVal = ഀ
"" ഀ
end ഀ
if
ഀ
if Len(txtVal) <> 0 ഀ
then ഀ
select case ഀ
fdType ഀ
case 16, 2, 3, 20, 17, 18, 19, 21, 4, 5, 6, 14, 131, ഀ
11 ഀ
if IsNumeric(txtVal) ഀ
then ഀ
RS(i) = ഀ
txtVal ഀ
else ഀ
bErr = ഀ
true ഀ
msgErr = fdName & " must be a numeric data. Please go ഀ
back." ഀ
end ഀ
if ഀ
case ഀ
else ഀ
RS(i) = ഀ
txtVal ഀ
end ഀ
select ഀ
end if ഀ
next if bErr = ഀ
false ഀ
then ഀ
RS.Update ഀ
RS.MoveLast ഀ
else ഀ
RS.CancelUpdate ഀ
end if on error goto ഀ
0 end select End ഀ
If %>