手工双档

」虫腹_Create_Init.asp
弧
GetCreateSQLCommand() 干材眎戈ぇ SQL 絏
絛ㄒ
Sub GetCreateSQLCommand()
On Error Resume Next
Dim arySQL(1, 1)
arySQL(0, 0) = "rstTESTA" 'Recordset嘿
arySQL(1, 0) = "select * from testa where (1=2)" 'SQL
arySQL(0, 1) = "rstTESTB"
arySQL(1, 1) = "select * from testb where (1=2)"
Session("arySQL") = arySQL

If Err.Number <> 0 Then
strErrReason = "﹚竡玻ネ虫ぇSQL皚祇ネ岿粇. (GetCreateSQLCommand)"
Response.Redirect "../Error.asp?ErrReason=" & strErrReason & "&ErrorSource=" & Err.source & "&ErrNumber=" & Err.Number & "&ErrDesc=" & Err.Description & "&blnHistoryBack=FALSE"
End If
End Sub

--------------------------------------だ--筳--絬-------------------------------------------------

」虫腹_Create.asp
弧
セ asp 程 Grid ぇ╰参郎
絛ㄒ






--------------------------------------だ--筳--絬-------------------------------------------------

」CheckFieldData.asp
弧
埃セぇ CheckFieldData() 惠 CheckFieldData_A()ず级糶浪琩虫ōぇ祘Α絏
絛ㄒ
function CheckFieldData_A()
on error resume next
dim blnError, strmsg
dim GridArray, i, n
blnError = false

' 腹
if trim(document.all("TESTB003").value) = "" then
strmsg = "[腹]ぃ眔フ." & chr(13)
blnError = true
else
GridArray = Grid1.GetGridArray
If IsArray(GridArray) = True Then
n = UBound(GridArray, 1)
For i = 0 To n
'腹琌滦
if (trim(document.all("TESTB003").value) = Trim(CStr(GridArray(i, 0)))) then
strmsg = "[腹]滦." & chr(13)
blnError = true
exit for
end if
Next
end if
end if
end sub

弧
干虫ō戈ぇ穝糤埃のэ onclick ㄆン
絛ㄒ
Sub btnAdd_onclick()
Dim RowBuf
ReDim RowBuf(GRID_COLUMNS - 1)

' ㊣虫ō逆戈浪琩ㄧΑ
if CheckFieldData_A() = false then
exit sub
end if

'腹
RowBuf(0) = document.all("TESTB003").Value
'珇嘿
RowBuf(1) = document.all("TESTB004").Value
'砏
RowBuf(2) = document.all("TESTB005").Value
'虫
RowBuf(3) = document.all("TESTB006").Value
'计秖
RowBuf(4) = cdbl(document.all("TESTB007").Value)
'虫基
RowBuf(5) = cdbl(document.all("TESTB008").Value)
'肂
RowBuf(6) = cdbl(document.all("TESTB009").Value)
'惠―ら戳
RowBuf(7) = docum

ent.all("TESTB010").Value
'
Grid1.AddItem RowBuf
Call Clear_Item
Call CalcGrid
document.all("TESTB003").focus
End Sub

Sub btnDel_onclick()
Grid1.DelItem
Call CalcGrid
End Sub

Sub btnEdit_onclick()
Dim RowBuf
RowBuf = Grid1.EditItem

If IsArray(RowBuf) = False Then Exit Sub
document.all("TESTB003").Value = RowBuf(0)
document.all("TESTB004").Value = RowBuf(1)
document.all("TESTB005").Value = RowBuf(2)
document.all("TESTB006").Value = RowBuf(3)
document.all("TESTB007").Value = RowBuf(4)
document.all("TESTB008").Value = RowBuf(5)
document.all("TESTB009").Value = RowBuf(6)
document.all("TESTB010").Value = RowBuf(7)
End Sub

--------------------------------------だ--筳--絬-------------------------------------------------

」UserFunc.asp
弧
砞﹚虫璹竡跑计
絛ㄒ
'========= 虫﹚竡跑计==============
dim rstTESTA,rstTESTB
Dim GRID_COLUMNS
'======================================

弧
穝糤祘Α絏 GetFieldData()琵虫ō戈眔眖タΑ戈既戈砞﹚ Grid 把计
絛ㄒ
 set rstTESTB = objDB.CreateRecordset("<%=arySQL(1,1)%>",strProcID)

<%if Session("FormStatus")="Create" or Session("FormStatus")="Approve" then%>
'虫ōGrid逆计
Grid1.style.top = "210px"
Grid1.style.left = " 30px"
Grid1.style.width = "460px"
Grid1.style.height = "100px"
<%else%>
Grid1.style.top = "160px"
Grid1.style.left = " 30px"
Grid1.style.width = "460px"
Grid1.style.height = "150px"
<%end if%>
GRID_COLUMNS = 8
Call Grid1_SetLayout
Grid1.Init

弧
糤 Grid1_SetLayout()
絛ㄒ
'*********************************************************************
'祘嘿: Grid1_SetLayout()
'祘弧: ㄏノ璹ㄧ计
'*********************************************************************
Sub Grid1_SetLayout()
Dim ColsTitle
Dim ColsWidth
Dim GridArray

ReDim ColsTitle(GRID_COLUMNS - 1)
ColsTitle(0) = "腹"
ColsTitle(1) = "珇嘿"
ColsTitle(2) = "砏"
ColsTitle(3) = "虫"
ColsTitle(4) = "计秖"
ColsTitle(5) = "虫基"
ColsTitle(6) = "肂"
ColsTitle(7) = "惠―ら戳"
'
ReDim ColsWidth(GRID_COLUMNS - 1)
ColsWidth(0) = 500
ColsWidth(1) = 1200
ColsWidth(2) = 1200
ColsWidth(3) = 500
ColsWidth(4) = 500
ColsWidth(5) = 1000
ColsWidth(6) = 1000
ColsWidth(7) = 1000
'
'戈陪ボ竚
Dim ColAlignment
ReDim ColAlignment(GRID_COLUMNS - 1)
ColAlignment(0) = "LEFT" '腹

ColAlignment(1) = "LEFT" '珇嘿
ColAlignment(2) = "LEFT" '砏
ColAlignment(3) = "LEFT" '虫
ColAlignment(4) = "RIGHT" '计秖
ColAlignment(5) = "RIGHT" '虫基
ColAlignment(6) = "RIGHT" '肂
ColAlignment(7) = "LEFT" '惠―ら戳

Grid1.ColsAlignment = ColAlignment
Grid1.Cols = GRID_COLUMNS
Grid1.ColsTitle = ColsTitle
Grid1.ColsWidth = ColsWidth
'
GridArray = ReadGridData()
Grid1.SetGridArray GridArray
End Sub

弧
糤 ReadGridData()砞﹚ Grid1 ず甧
絛ㄒ
'*********************************************************************
'祘嘿: ReadGridData()
'祘弧: ㄏノ璹ㄧ计
'*********************************************************************
Function ReadGridData()
on error resume next
Dim GridArray,n

n = rstTESTB.RecordCount

If n > 0 Then
ReDim GridArray(n - 1, GRID_COLUMNS - 1)
n = 0

Do While Not rstTESTB.EOF
if err.number <> 0 then
blnError = True
strErrReason = "ReadGridData()"
window.Parent.document.location = "../Error.asp?ErrReason=" & strErrReason & "&ErrorSource=" & Err.source & "&ErrNumber=" & Err.Number & "&ErrDesc=" & Err.Description & "&blnHistoryBack=FALSE"
end if


GridArray(n, 0) = rstTESTB("testb003")

GridArray(n, 1) = rstTESTB("testb004")

GridArray(n, 2) = rstTESTB("testb005")

GridArray(n, 3) = rstTESTB("testb016")

GridArray(n, 4) = rstTESTB("testb006")

GridArray(n, 5) = rstTESTB("testb007")

GridArray(n, 6) = rstTESTB("testb008")

GridArray(n, 7) = rstTESTB("testb009")

GridArray(n, 8) = rstTESTB("testb013")

GridArray(n, 9) = rstTESTB("testb010")

GridArray(n, 10) = rstTESTB("testb011")

GridArray(n, 11) = rstTESTB("testb012")

GridArray(n, 12) = rstTESTB("testb014")

GridArray(n, 13) = rstTESTB("testb015")


rstTESTB.MoveNext
n = n + 1
Loop

End If
ReadGridData = GridArray
if err.number <> 0 then
blnError = True
strErrReason = "ReadGridData()"
window.Parent.document.location = "../Error.asp?ErrReason=" & strErrReason & "&ErrorSource=" & Err.source & "&ErrNumber=" & Err.Number & "&ErrDesc=" & Err.Description & "&blnHistoryBack=FALSE"
end if
End Function 

弧
 GetRS() い糤祘Α絏ㄏ虫陪ボ既戈い戈
絛ㄒ
objEF2KRS.GetRS("rstTESTB",rstTESTB)

弧
穝糤虫ō场

ぇ祘Α絏 StoreFieldData()ㄏ眔虫ō戈眔既戈
絛ㄒ
'虫ō
dim i,n,GridArray

if rstTESTB.RecordCount > 0 then
rstTESTB.MoveFirst
do while not rstTESTB.eof
rstTESTB.delete
rstTESTB.MoveNext
loop
end if
GridArray = Grid1.GetGridArray
If IsArray(GridArray) = True Then
n = UBound(GridArray, 1)
For i = 0 To n
rstTESTB.AddNew
'腹
rstTESTB("testb003").Value = Trim(CStr(GridArray(i, 0)))
'珇嘿
rstTESTB("testb004").Value = Trim(CStr(GridArray(i, 1)))
'砏
rstTESTB("testb005").Value = Trim(CStr(GridArray(i, 2)))
'虫
rstTESTB("testb006").Value = Trim(CStr(GridArray(i, 3)))
'计秖
rstTESTB("testb007").Value = Trim(CDbl(GridArray(i, 4)))
'虫基
rstTESTB("testb008").Value = Trim(CDbl(GridArray(i, 5)))
'肂
rstTESTB("testb009").Value = Trim(CDbl(GridArray(i, 6)))
'惠―ら戳
rstTESTB("testb010").Value = Trim(CStr(GridArray(i, 7)))
Next
End If

弧
穝糤祘Α絏 StoreRS()ㄏ虫ō戈眔タΑ戈
絛ㄒ
blnRtn = objEF2KRS.StoreRS("rstTESTB",rstTESTB)
if Not blnRtn then
StoreRS = StoreRS & "盢Recordset(rstTESTB)既跋祇ネ岿粇.(StoreRS)"
end if

--------------------------------------だ--筳--絬-------------------------------------------------

」虫腹_Display_Init.asp
弧
穝糤祘Α絏 GetDisplaySQLCommand()ㄏ虫陪ボ虫ō戈
絛ㄒ
arySQL(0,0) = "rstTESTB" 'Recordset Name
arySQL(1,1) = "select * from testb where testb001='" & Session("FormID") & "' and testb002='" & Session("SheetNo") & "'"

--------------------------------------だ--筳--絬-------------------------------------------------

」虫腹_Display.asp
弧
虫逆祘Α絏程︽陪ボ Grid 祘Α絏
絛ㄒ






--------------------------------------だ--筳--絬-------------------------------------------------

」虫腹_Approve_Init.asp
弧
 GetApproveSQLCommand() ㄧ计い弄虫ō戈ぇ SQL 絏
絛ㄒ
arySQL(0,1) = "rstTESTB" 'Recordset Name
arySQL(1,1) = "select * from testb where testb001='" & Session("FormID") & "' and testb002='" & Session("SheetNo") & "'"

--------------------------------------だ--筳--絬-------------------------------------------------

」虫腹_Approve.asp
弧
虫逆祘Α絏程︽陪ボ Grid 祘Α

絏
絛ㄒ





相关文档
最新文档