// ASP - DB(Oracle, ms-sql) 연결 소스
<%
Const DB_SVR_IP = "10.124.XXX.XXX" ' DB IP
Const DB_SVR_PORT = "1521" ' DB PORT
Const DB_SVR_CATALOG = ""
Const DB_SVR_ID = "conn_id" ' DB ID
Const DB_SVR_PWD = "conn_pw" ' DB PW
Const DB_SVR_TNS = "SID_DB" ' DB명
' MS-SQL 연결
'strConnect = "PROVIDER=SQLOLEDB;DATA SOURCE=" & DB_SVR_IP & ";UID=" & DB_SVR_ID & ";PWD=" & DB_SVR_PWD & ";DATABASE=" & DB_SVR_TNS & " "
' ORACLE 연결
strConnect = "Provider=MSDAORA; Data Source=" & DB_SVR_TNS & "; User ID=" & DB_SVR_ID & ";Password=" & DB_SVR_PWD & ""
Set dbcon = Server.CreateObject("ADODB.Connection")
dbcon.Open strConnect
Set Rs = Server.CreateObject("ADODB.RecordSet")
strSQL = ""
strSQL = " SELECT A.FACT_CD , A.LINE_CD , NVL(DSINFO.FN_UPH_TIME_ZONE('B','2000', TO_CHAR(FN_WORK_DATE_IN ...... "
Rs.Open strSQL, dbcon
dim sRtnVal
sRtnVal = ""
if (Rs.eof and Rs.bof) then
' 조회된 데이터가 없다면(NULL) 기본 0 값을 출력
sRtnVal = sRtnVal & "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
else
'sRtnVal = Rs(0) & "," & Rs(1) & "," & Rs(2) & "," & Rs(3) & "," & Rs(4) & "," & Rs(5) & ","
sRtnVal = Rs(2) & "," & Rs(3) & "," & Rs(4) & "," & Rs(5) & ","
sRtnVal = sRtnVal & Rs(6) & "," & Rs(7) & "," & Rs(8) & "," & Rs(9) & "," & Rs(10) & "," & Rs(11) & ","
sRtnVal = sRtnVal & Rs(12) & "," & Rs(13) & "," & Rs(14) & "," & Rs(15) & "," & Rs(16) & "," & Rs(17) & ","
sRtnVal = sRtnVal & Rs(18) & "," & Rs(19) & "," & Rs(20) & "," & Rs(21) & "," & Rs(22) & "," & Rs(23)
end if
response.write "RTN_DATA=" & sRtnVal
%>
<%
Rs.Close
Set Rs = nothing
dbcon.Close
Set dbcon = nothing
%>
'020. Prigraming > 10. Web' 카테고리의 다른 글
[Flutter] 지뢰찾기 (0) | 2022.11.25 |
---|---|
[Flutter] 공부를 시작하지 (0) | 2022.08.13 |
[ASP] 간단한 저장프로시저 예제 (0) | 2010.05.12 |
asp.net과 플래시 변수 연동(디비까지) (0) | 2010.04.06 |
[PHP] my-sql DB 연결하기 (0) | 2010.03.01 |
WRITTEN BY
- 테네시왈츠
항상 겸손하게 항상 새롭게 항상 진실하게