【文章內(nèi)容簡(jiǎn)介】
39。 boolean to abort record edit MM_abortEdit = false 39。 query string to execute MM_editQuery = % % 39。 *** Insert Record: set variables If (CStr(Request(MM_insert)) = 3) Then MM_editConnection = MM_coon_STRING MM_editTable = xinwen MM_editRedirectUrl = MM_fieldsStr = 1|value|2|value MM_columnsStr = biaoti|39。,none,39。39。|meirong|39。,none,39。39。 39。 create the MM_fields and MM_columns arrays MM_fields = Split(MM_fieldsStr, |) MM_columns = Split(MM_columnsStr, |) 39。 set the form values For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_fields(MM_i+1) = CStr((MM_fields(MM_i))) Next 39。 append the query string to the redirect URL If (MM_editRedirectUrl And ) Then If (InStr(1, MM_editRedirectUrl, ?, vbTextCompare) = 0 And ) Then MM_editRedirectUrl = MM_editRedirectUrl amp。 ? amp。 Else MM_editRedirectUrl = MM_editRedirectUrl amp。 amp。 amp。 End If End If End If % % 39。 *** Insert Record: construct a sql insert statement and execute it Dim MM_tableValues Dim MM_dbValues If (CStr(Request(MM_insert)) ) Then 39。 create the sql insert statement MM_tableValues = MM_dbValues = For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_formVal = MM_fields(MM_i+1) MM_typeArray = Split(MM_columns(MM_i+1),) MM_delim = MM_typeArray(0) If (MM_delim = none) Then MM_delim = MM_altVal = MM_typeArray(1) If (MM_altVal = none) Then MM_altVal = MM_emptyVal = MM_typeArray(2) If (MM_emptyVal = none) Then MM_emptyVal = If (MM_formVal = ) Then MM_formVal = MM_emptyVal Else If (MM_altVal ) Then MM_formVal = MM_altVal ElseIf (MM_delim = 39。) Then 39。 escape quotes MM_formVal = 39。 amp。 Replace(MM_formVal,39。,39。39。) amp。 39。 Else MM_formVal = MM_delim + MM_formVal + MM_delim End If End If If (MM_i LBound(MM_fields)) Then MM_tableValues = MM_tableValues amp。 , MM_dbValues = MM_dbValues amp。 , End If MM_tableValues = MM_tableValues amp。 MM_columns(MM_i) MM_dbValues = MM_dbValues amp。 MM_formVal Next MM_editQuery = insert into amp。 MM_editTable amp。 ( amp。 MM_tableValues amp。 ) values ( amp。 MM_dbValues amp。 ) If (Not MM_abortEdit) Then 39。 execute the insert Set MM_editCmd = () = MM_editConnection = MM_editQuery If (MM_editRedirectUrl ) Then (MM_editRedirectUrl) End If End If End If % % Dim rs1 Dim rs1_numRows Set rs1 = () = MM_coon_STRING = SELECT * FROM dinggou ORDER BY id DESC = 0 = 2 = 1 () rs1_numRows = 0 % % Dim rs2__MMColParam rs2__MMColParam = 1 If ((id) ) Then rs2__MMColParam = (id) End If % % Dim rs2 Dim rs2_numRows Set rs2 = () = MM_coon_STRING = SELECT * FROM ly WHERE id = + Replace(rs2__MMColParam, 39。, 39。39。) + ORDER BY id DESC = 0 = 2 = 1 () rs2_numRows = 0 % % 39。 *** Recordset Stats, Move To Record, and Go To Record: declare stats variables Dim rs1_total Dim rs1_first Dim rs1_last 39。 set the record count rs1_total = 39。 set the number of rows displayed on this page If (rs1_numRows 0) Then rs1_numRows = rs1_total Elseif (rs1_numRows = 0) Then rs1_numRows = 1 End If 39。 set the first and last displayed record rs1_first = 1 rs1_last = rs1_first + rs1_numRows 1 39。 if we have the correct record count, check the other stats If (rs1_total 1) Then If (rs1_first rs1_total) Then rs1_first = rs1_total End If If (rs1_last rs1_total) Then rs1_last = rs1_total End If If (rs1_numRows rs1_total) Then rs1_numRows = rs1_total End If End If % % 39。 *** Recordset Stats: if we don39。t know the record count, manually count them If (rs1_total = 1) Then 39。 count the total records by iterating through the recordset rs1_total=0 While (Not ) rs1_total = rs1_total + 1 Wend 39。 reset the cursor to the beginning If ( 0) Then Else End If 39。 set the number of rows displayed on this page If (rs1_numRows 0 Or rs1_numRows rs1_total) Then rs1_numRows = rs1_total End If 39。 set the first and last displayed record rs1_first = 1 rs1_last = rs1_first + rs1_numRows 1 If (rs1_first rs1_total) Then rs1_first = rs1_total End If If (rs1_last rs1_total) Then rs1_last = rs1_total End If End If % % Dim MM_paramName % % 39。 *** Move To Record and Go To Record: declare variables Dim MM_rs Dim MM_rsCount Dim MM_size Dim MM_uniqueCol Dim MM_offset Dim MM_atTotal Dim MM_paramIsDefined Dim MM_param Dim MM_index Set MM_rs = rs1 MM_rsCount = rs1_total MM_size = rs1_numRows MM_uniqueCol = MM_paramName = MM_offset = 0 MM_atTotal = false MM_paramIsDefined = false If (MM_paramName ) Then MM_paramIsDefined = ((MM_paramName) ) End If % % 39。 *** Move To Record: handle 39。index39。 or 39。offset39。 parameter if (Not MM_paramIsDefined And MM_rsCount 0) then 39。 use index parameter if defined, otherwise use offset parameter MM_param = (index) If (MM_param = ) Then MM_param = (offset) End If If (MM_param ) Then MM_offset = Int(MM_param) End If 39。 if we have a record count, check if we are past the end of the recordset If (MM_rsCount 1) Then If (MM_offset = MM_rsCount Or MM_offset = 1) T