ASP + Oracle Paging + MSSQL

2013. 10. 29. 10:25

<%

Option Explicit

%>

<!--#include file="..\..\function\auth_admin.inc"-->

<!--#include virtual="/injection_func.asp"-->

<%


dim strsql, ArrRs, i, sex, sql

Dim TotalRecord, FirstColumn, LastColumn, FirstPage, LastPage, TotalPage

Dim CurrentPage : CurrentPage = Request.QueryString("CurrentPage")

If CurrentPage = "" Then CurrentPage = 1

Dim PageLength : PageLength = 10

Dim MoveSize : MoveSize = 10


dbCon.Open Application("DBInfo")

dbCon1.Open Application("ORADBInfo")


strSql = "SELECT COUNT(*) FROM HAKSADB.HAKJUK_INFO"

rs1.Open strSql, dbcon1

If rs1.eof=False And rs1.bof=False Then

TotalRecord = rs1(0)

End If

rs1.close


FirstColumn = (CurrentPage -1) * PageLength +1

LastColumn = CurrentPage * PageLength


If CDbl(LastColumn) > CDbl(TotalRecord) Then

LastColumn = TotalRecord

End If


TotalPage = Int(CDbl(TotalRecord) / CDbl(PageLength))


If CDbl(TotalRecord) Mod CDbl(PageLength) > 0 Then

TotalPage = TotalPage + 1

End If


FirstPage = CInt((CurrentPage - 0.8) \ MoveSize) * MoveSize +1

LastPage = FirstPage + MoveSize -1


If LastPage > TotalPage Then

LastPage = TotalPage

End if


strSql = " SELECT RN, STDNO, KOR_NM, COLG, SUST, NOW_SHYR, GEN,"

strSql = strSql & " POST, ADDR, COCT_TEL, COCT_HAND, EMAIL, COLG_NM, SUST_NM"

strSql = StrSql & " FROM     (SELECT ROWNUM AS RN, X.*"

strSql = StrSql & " FROM    (SELECT S.STDNO, S.KOR_NM, S.COLG, S.SUST, S.NOW_SHYR, S.GEN,"

strSql = StrSql & " S.POST, S.ADDR, S.COCT_TEL, S.COCT_HAND, S.EMAIL, S.COLG_NM, S.SUST_NM"

strSql = strSql & " FROM    HAKSADB.HAKJUK_INFO S) X"

strSql = strSql & " )"

strSql = strSql & " WHERE RN>= '" & FirstColumn & "' AND RN<='" & LastColumn & "'"

strSql = strSql & " ORDER BY RN ASC"


'response.write strSql & "<BR>"

'response.end


rs1.Open strSql, dbcon1


If rs1.eof=False And rs1.bof=False then

ArrRs = rs1.getRows()

For i = 0 To UBound(ArrRs,2)

strSql = "SELECT * FROM 개인회원정보 WHERE 개인아이디 = '" & ArrRs(1, i) & "'"

rs.Open strSql, dbcon

If rs.eof=False And rs.bof=False Then


If ArrRs(6, i) = "남" Then

sex = "1"

Else

sex = "2"

End If


strSql = " UPDATE 개인회원정보 SET 성명 = '" & ArrRs(2, i) & "', "

strSql = strSql & " 계열 = '" & ArrRs(3, i) & "', "

strSql = strSql & " 학과 = '" & ArrRs(4, i) & "', "

strSql = strSql & " 전공 = '" & ArrRs(4, i) & "', "

strSql = strSql & " 학년 = '" & ArrRs(5, i) & "', "

strSql = strSql & " 주민번호성별 = '" & sex & "', "

strSql = strSql & " 우편번호 = '" & ArrRs(7, i) & "', "

strSql = strSql & " 주소 = '" & ArrRs(8, i) & "', "

strSql = strSql & " 전화번호 = '" & ArrRs(9, i) & "', "

strSql = strSql & " 휴대폰 = '" & ArrRs(10, i) & "', "

strSql = strSql & " 전자우편 = '" & ArrRs(11, i) & "', "

strSql = strSql & " 계열명 = '" & ArrRs(12, i) & "', "

strSql = strSql & " 학과명 = '" & ArrRs(13, i) & "', "

strSql = strSql & " 전공명 = '" & ArrRs(13, i) & "', "

strSql = strSql & " 수정일 = getdate()"

strSql = strSql & " WHERE 개인아이디 = '" & ArrRs(1, i) & "'"


response.write strSql & "<BR>"


End If

rs.close

next

End If

%>

<OBJECT RUNAT="SERVER" PROGID="ADODB.RecordSet" ID="Rs"></OBJECT>

<OBJECT RUNAT="SERVER" PROGID="ADODB.RecordSet" ID="Rs1"></OBJECT>

<OBJECT RUNAT="SERVER" PROGID="ADODB.Connection" ID="dbCon"></OBJECT>

<OBJECT RUNAT="SERVER" PROGID="ADODB.Connection" ID="dbCon1"></OBJECT>

Posted by 회사원Z
:

카테고리

More More* (98)
iPHONE* (7)
Power Builder* (31)
HTML5* (2)
CSS3* (1)
jQuery & JavaScript* (17)
ASP* (20)
MSSQL* (10)
ETC* (10)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

달력

«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

글 보관함