2011년 11월 3일 목요일

ASP_Server.CreateObject 설명

네이버 지식인에서 긁어왔습니다. 좋은지식 감사합니다. (--)(__)(--)

1.ADODB.connention : 데이터베이스 커넥션
객체로 데이터베이스 서버와 연결을 하는 구문입니다.
한마디로 Recrodset과 DB간의 연결통로를 구성하기위에 Connection 개체를 만들어야 합니다.
예) set db = Server.Createobject("Adodb.connection")
           db.open 연결주소, 접속아이디, 암호

2.ADODB.Recordset : 데이터 레코드셋
만들어진 sql 문장을 이용하여 Recrodset 개체를 open 하면 DB로부터 데이타가 전송되어 Recordset 개체에 저장되게 됩니다.

예) set rs = Server.Createobject("Adodb.Recrodset")
           rs.open sql, db, 1, 2

3. ABCUpload4.XForm : abc 업로드 컴포넌트 객체 생성
사이트 갤럭시, ABC, DEXT 등 다양한 업로드 컴포넌트 객체를 생성시킬 수 있습니다.

예) Set upload = Server.CreateObject("ABCUpload4.XForm")

4. Excel.Application : 에플리케이션 객체 생성
엑셀 파일 저장 및 웹에서의 편집 그외에 파워포인트 등 다양한 에플리케이션을 연결합니다.

예) Set excel = Server.CreateObject("Excel.Application")

5. CDO.Message : 메일 객체 생성
CDO 메일 및 각종 메일서버 객체를 생성하여 메일을 보내기도 합니다.

예) Server.CreateObject("CDO.Message")

ASP_UBound 함수

UBound() UBound([배열명]] 배열의 요소 갯수를 알려주는 함수 JSP에서는 arr.length
exam)
Private Sub BuiltInCommand( byVal cmd, byVal params)
  If Not IsArray(params) Then Exit Sub
  Dim i
  For i=0 To UBound(params,1)
   cmd.Parameters.Append cmd.CreateParameter( _
        params(i)(0), _
        params(i)(1), _
        params(i)(2), _
        params(i)(3), _
        params(i)(4) _
        )
  'Response.Write params(i)(4) & "<br>"
  Next
 End Sub

2011년 11월 1일 화요일

DIR명령어로 파일리스트 뽑아 내기

dir /s /b *.asp >> fileList.txt

/s : 하위폴더까지 모두 검색합니다.
/b: 기본정보를 제거 하고 출력합니다.

>> write합니다.
fileList.txt 파일명입니다.

2011년 10월 27일 목요일

JAVA_소수점 둘째짜리에서 자르기

DecimalFormat df = new DecimalFormat("######0.00");
df.format(소수점 타입의 데이타);

2011년 10월 18일 화요일

JAVA_코딩 테크닉_자바 백분율 예제

for (Iterator<Object> i = tArr.iterator();i.hasNext();)
{
hm = (HashMap<String, Object>)i.next();
tempResultTotal += Double.parseDouble(String.valueOf(hm.get("RESULT_TOTAL")));
}

=========================================================================


HashMap map = (HashMap)itr.next();


resultPer = Double.parseDouble(map.get("RESULT_PER").toString());
planPer = Double.parseDouble(map.get("PLAN_PER").toString());

if(resultPer < 1)
{
resultPer = 0*0.01d;
}

if(planPer > 0)
{
resultPerTotal = resultPer / planPer;
bDecimal = new BigDecimal(resultPerTotal).setScale(2, BigDecimal.ROUND_HALF_UP);
resultPerTotal = Double.parseDouble(bDecimal.toString());
}
else
{
planPer = 0*0.01d;
}


tempResult = Double.parseDouble(String.valueOf(map.get("RESULT_TOTAL")));

if(tempResultTotal > 0)
{
tempResult = tempResult / tempResultTotal * 100;
bDecimal = new BigDecimal(tempResult).setScale(2, BigDecimal.ROUND_HALF_UP);
tempResult = Double.parseDouble(bDecimal.toString());


}
else
{
tempResult = 0*0.01d;
}


tempPlan = Double.parseDouble(String.valueOf(map.get("PLAN_PER_TOTAL")));
if(tempPlan > 0)
{
tempPeref = tempResult / tempPlan ;
bDecimal = new BigDecimal(tempPeref).setScale(2, BigDecimal.ROUND_HALF_UP);
tempPeref = Double.parseDouble(bDecimal.toString());
}

2011년 10월 14일 금요일

JAVA_코딩 테크닉 자바에서 소수점 자리 계산

자바에서 소수점 자리 계산P.L(file)
2006/10/19 10:50

소수점 둘째자리 까지 값을 구하기..
1. BigDecimal2. DecimalFormat


import java.math.BigDecimal;
import java.text.DecimalFormat;

double rate = (double)37/6;

System.out.println("---->rate : " + rate);
BigDecimal bD = new BigDecimal(rate);

System.out.println("------>BigDecimal : " + bD);
bD.setScale(2, java.math.BigDecimal.ROUND_HALF_UP); //소수점 2자리 ,반올림..

System.out.println("------>setScale : " + bD.setScale(2, java.math.BigDecimal.ROUND_HALF_UP));
DecimalFormat fourDigits = new DecimalFormat("0.00"); //소수점 밑 2자리까지
String A = fourDigits.format(rate);

System.out.println("DecimalFormat: "+ A);

===============================================================================
결과
===============================================================================
------->rate : 6.166666666666667

---------->BigDecimal : 6.16666666666666696272613990004174411296844482421875

---------->setScale : 6.17

DecimalFormat: 6.17

2011년 10월 10일 월요일

JAVA_코딩 테크닉 20110811.substring (begin, end) 년,월,일 자르기

할때마다 해깔린다..


cal.set(Integer.parseInt(startDate.substring(0, 4)),
Integer.parseInt(startDate.substring(4, 6)),
Integer.parseInt(startDate.substring(6, 8)));