代码复制

    <%
    Dim oRs, oSQL, TalbeName, WhereId
    TalbeName = Easp.Get("TalbeName:s")
    WhereId = "Id"
    If Easp.IsN(TalbeName) Then
        Easp.Alert "表名不能为空!"
    End If
    '================================================
    Dim TempFieldList, TempPostList, ListNew, ListAdd, ListEdit, Conn, i
    Dim InfoList,oRsList
    TempFieldList = ""
    TempPostList = ""
    ListNew = ""
    oRsList = ""
    InfoList = "Dim oRs,FieldList,"
    Set Conn = Easp.db.Conn
    oSQL = "Select * From ["& TablePrefix & TalbeName &"] "
    Set oRs = Conn.Execute(oSQL)
    For i = 0 To oRs.Fields.Count -1
        If (i = 0 Or i = 5 Or i = 10 Or i = 15) Then
            TempFieldList = TempFieldList & "Dim "
        End If
        If (oRs.Fields(i).Name <> "AddTime" And oRs.Fields(i).Name <> "UpTime") Then
            TempFieldList = TempFieldList & oRs.Fields(i).Name & ","
            TempPostList = TempPostList & oRs.Fields(i).Name & " = Easp.Post("""& oRs.Fields(i).Name & GetFieldNum(oRs.Fields(i).Type) &""")" & vbCrLf
            If (LCase(oRs.Fields(i).Name) <> "id") Then
                ListNew = ListNew & "List("""& oRs.Fields(i).Name &""") = " & oRs.Fields(i).Name & vbCrLf
            End If
        End If
        If (i = 4 Or i = 9 Or i = 14) Then
            TempFieldList = TempFieldList & vbCrLf
        End If
    	InfoList = InfoList & oRs.Fields(i).Name & ","
    	oRsList = oRsList & oRs.Fields(i).Name & " = oRs("""& oRs.Fields(i).Name &""")" & VbCrlf
    Next
    Easp.WC "'================================================ 列出字段"
    Easp.WC TempFieldList
    Easp.WC "'================================================ 列出字段2"
    Easp.WC InfoList
    Easp.WC "'================================================ oRs"
    Easp.WC oRsList
    Easp.WC "'================================================ Post"
    Easp.WC TempPostList
    Easp.WC "'================================================ 增"
    ListAdd = "Dim List, ResultVal" & vbCrLf
    ListAdd = ListAdd & "Easp.Use ""list""" & vbCrLf
    ListAdd = ListAdd & "Set List = Easp.List.New" & vbCrLf
    ListAdd = ListAdd & ListNew
    ListAdd = ListAdd & "List(""AddTime"") = Now()" & vbCrLf
    ListAdd = ListAdd & "ResultVal = Easp.db.AR(TablePrefix & """& TalbeName &":Id"", List.Hash)" & vbCrLf
    ListAdd = ListAdd & "Easp.C List" & vbCrLf
    ListAdd = ListAdd & "If ResultVal <> 0 Then" & vbCrLf
    ListAdd = ListAdd & "'=======================" & vbCrLf
    ListAdd = ListAdd & "End If" & vbCrLf
    Easp.WC ListAdd
    Easp.WC "'================================================ 改"
    ListEdit = "Dim List, ResultVal" & vbCrLf
    ListEdit = ListEdit & "Easp.Use ""list""" & vbCrLf
    ListEdit = ListEdit & "Set List = Easp.List.New" & vbCrLf
    ListEdit = ListEdit & ListNew
    ListEdit = ListEdit & "ResultVal = Easp.db.UR(TablePrefix & """& TalbeName &""", "" Id = ""& Id &"" "", List.Hash)" & vbCrLf
    ListEdit = ListEdit & "Easp.C List" & vbCrLf
    ListEdit = ListEdit & "If ResultVal <> 0 Then" & vbCrLf
    ListEdit = ListEdit & "'=======================" & vbCrLf
    ListEdit = ListEdit & "End If" & vbCrLf
    Easp.WC ListEdit
    %>

<% Function GetFieldNum(ByVal i) Dim strTemp Select Case CmsFun.ChkNumEric(i) Case 3 strTemp = ":n:0" Case 202, 203 strTemp = ":s" Case Else strTemp = "" End Select GetFieldNum = strTemp End Function %>