I was through arduous hardships, Ba Shan Wade Ah, finally finished this page, but this also want to thank the JSP, because yesterday when the whim, suddenly want to learn JSP, so find a few articles, after reading feel javabean too cow x, Feel a bit like I usually write ASP when the processing mode: is a page layout, another background processing.
Just in time to see a common approach to it, so I also designed an ASP, but only in the SQL Server, because I often use SQL database.
I wrote the following page, please advise!
When used, you can write in the Submit form:
which
TBL: To manipulate the name of the datasheet
KEYV: For conditional statements, multiple conditions can be separated by $
On Error Resume Next
Dim keya,condition,temp ' Temporary Variable
Dim insstr,insstr1,insstr2,delstr,updstr,rltstr
Tbl=request. QueryString ("TBL") ' Table name
Keyv=request. QueryString ("Keyv") ' Key field name
Condition= ""
Keya=split (KEYV, "$")
For all I in Keya
If temp<> "" Then
End If
Condition=left (Condition,len (condition)-5)
'----------manipulate the database
Dbconn.open ConnStr ' connstr is a database connection string.
sqlstr= "exec a_tblinfo '" &tbl& ""
'---------recordset is null processing
Response. Clear ()
Response. End ()
'---------------------------insert operation
insstr1= INSERT INTO [&tbl&] ("
While not dbrst.eof
Fldv=request. Form (FLD)
insstr1=insstr1&fld& ","
End If
Wend
Rltstr= ""
Rltstr=left (Insstr1, (Len (INSSTR1)-1)) & ")" &left (Insstr2, (Len (INSSTR2)-1)) & ")"
'---------------------------Modify operation
updstr= "Update [" &tbl& "] set"
Fld=dbrst ("name")
If fldv<> "" and Dbrst ("Colstat") <>1 Then
End If
Wend
Rltstr= ""
Rltstr=left (Updstr, (Len (UPDSTR)-1)) &condition
'---------------------------Delete operation
delstr= "Delete from [&tbl&]"
Response. Clear ()
Response. End ()
'-------processing data records
Dbconn.execute Rltstr
Dbrst.close
Dbconn.close
%>
'----CursorTypeEnum Values----
' Const adOpenKeyset = 1
' Const adOpenStatic = 3
'----LockTypeEnum Values----
' Const adlockpessimistic = 2
' Const adlockbatchoptimistic = 4