Search

'분류 전체보기'에 해당되는 글 75건

  1. 2010.11.22 join, update
  2. 2010.10.15 예제코드
  3. 2010.10.06 프로시져 사용시 ADO타입
  4. 2010.10.05 전각/반각 구분하여 문자열 계산
  5. 2010.10.05 전각/반각 구분하여 문자열 계산

join, update

MS-SQL 2010. 11. 22. 12:31 Posted by Dayis
UPDATE titleauthor
   SET title_id = titles.title_id
   FROM titles INNER JOIN titleauthor 
      ON titles.title_id = titleauthor.title_id 
      INNER JOIN authors
      ON titleauthor.au_id = authors.au_id
   WHERE titles.title = 'Net Etiquette'
      AND au_lname = 'Locksley'

'MS-SQL' 카테고리의 다른 글

MS-SQL 인덱스 조각모음  (0) 2013.01.03
MS-SQL 전체 테이블 크기 조회 (용량순, 테이블이름순)  (0) 2012.08.16
declare cursor  (0) 2012.06.12
Join절 Update  (0) 2011.11.03
프로시져 사용시 ADO타입  (0) 2010.10.06

예제코드

ANDROID 2010. 10. 15. 21:27 Posted by Dayis

package study.chapter07.fileex;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

public class FileEx extends Activity implements View.OnClickListener {
 private EditText editText;
 private Button btnWrite;
 private Button btnRead;
 
 public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  
  LinearLayout layout = new LinearLayout(this);
  layout.setBackgroundColor(Color.rgb(255,255,255));
  layout.setOrientation(LinearLayout.VERTICAL);
  setContentView(layout);
  
  editText = new EditText(this);
  editText.setText("",EditText.BufferType.NORMAL);
  setLLParams(editText,240,50);
  layout.addView(editText);
  
  btnWrite = new Button(this);
  btnWrite.setText("쓰기");
  btnWrite.setOnClickListener(this);
  setLLParams(btnWrite);
  layout.addView(btnWrite);
  
  btnRead = new Button(this);
  btnRead.setText("읽기");
  btnRead.setOnClickListener(this);
  setLLParams(btnRead);
  layout.addView(btnRead);
  
 }

 private void setLLParams(Button btnWrite2) {
  // TODO Auto-generated method stub
  
 }

 private void setLLParams(EditText editText2, int i, int j) {
  // TODO Auto-generated method stub
  
 }

 public void onClick(View v) {
  if (v==btnWrite){
   try {
    String str = editText.getText().toString();
    str2file(this,str,"test.txt");
   } catch (Exception e){
    showDialog(this,"에러","쓰기 실패했습니다.");
   }
  } else if (v==btnRead) {
   try {
    String str = file2str(this,"text.txt");
    editText.setText(str,TextView.BufferType.EDITABLE);    
   } catch (Exception e) {
    showDialog(this,"에러","읽기 실패 했습니다.");
   }
   
  }
  
 }

 private static String file2str(Context context, String fileName) throws Exception {
  byte[] w = file2data(context,fileName);
  return new String(w);
 }

 private static byte[] file2data(Context context, String fileName) throws Exception {
  int size;
  byte[] w = new byte[1024];
  InputStream in = null;
  ByteArrayOutputStream out = null;
  try {
   in = context.openFileInput(fileName);
   out = new ByteArrayOutputStream();
   while(true){
    size=in.read(w);
    if (size<=0)
     break;
    out.write(w,0,size);
   }
   out.close();
   in.close();
   return out.toByteArray();
  } catch (Exception e){
   try {
    if(in!=null)
     in.close();
    if(out!=null)
     out.close();
   } catch (Exception e2){
    
   }
   throw e;
  }
 }

 private static void showDialog(final Activity activity,String title, String text) {
  AlertDialog.Builder ad = new AlertDialog.Builder(activity);
  
 }

 private static void str2file(Context context, String str, String fileName) throws Exception {
  // TODO Auto-generated method stub
  data2file(context,str.getBytes(),fileName);
 }

 private static void data2file(Context context, byte[] w, String fileName) throws Exception {
  OutputStream out = null;
  try {
   out = context.openFileOutput(fileName, Context.MODE_PRIVATE);
   out.write(w,0,w.length);
   out.close();
  } catch (Exception e) {
   try {
    if(out != null)
      out.close();
   } catch (Exception e2) {    
   }
   throw e;
  }  
 }

}

프로시져 사용시 ADO타입

MS-SQL 2010. 10. 6. 14:48 Posted by Dayis
 
ADO
DataType
Enum
ADO
DataType
Enum
Value
.NET
Framework
Visual
Basic
6.0
Access SQL
Server
Oracle
adBigInt 20 Int64
SqlInt64

BigInt
Variant   BigInt  
adBinary 128 Byte[]
SqlBinary

Binary
Variant   Binary
TimeStamp
Raw
adBoolean 11 Boolean
SqlBoolean

Boolean
Boolean YesNo Bit  
adBSTR 8 String
BSTR
       
adChapter 136 (DataReader)        
adChar 129 String 
SqlString

Char
String   Char Char
adCurrency 6 Decimal
SqlMoney

Currency
Currency Currency Money
SmallMoney
 
adDate 7 DateTime
Date
Date DateTime    
adDBDate 133 DateTime
DBDate
       
adDBFileTime 137 DBFileTime        
adDBTime 134 DateTime
DBTime
       
adDBTimeStamp 135 DateTime
SqlDateTime

DBTimeStamp
Date DateTime Datetime
 SmallDateTime
Date
adDecimal 14 Decimal
Decimal
Variant     Decimal
adDouble 5 Double
SqlDouble

Double
Double Double Float Float
adEmpty 0 Empty        
adError 10 External-Exception
Error
       
adFileTime 64 DateTime
Filetime
       
adGUID 72 Guid 
SqlGuid

Guid
Variant ReplicationID UniqueIdentifier  
adIDispatch 9 Object
IDispatch
       
adInteger 3 Int32
SqlInt32

Integer
Long  AutoNumber
 Integer
Long

Identity
Int

Int
adIUnknown 13 Object
IUnknown
       
adLongVarBinary 205 Byte[]
SqlBinary

LongVarBinary
Variant OLEObject Image Long Raw
Blob
adLongVarChar 201 String
SqlString

LongVarChar
String Memo
Hyperlink
Text Long
Clob
adLongVarWChar 203 String
SqlString

LongVarWChar
String Memo
Hyperlink
NText NClob
adNumeric 131 Decimal
SqlDecimal
Numeric
Variant Decimal Decimal
Numeric
Decimal
Integer
Number
SmallInt
adPropVariant 138 Object
PropVariant
       
adSingle 4 Single
SqlSingle

SIngle
Single Single Real  
adSmallInt 2 Int16,
SqlInt16

SmallInt
Integer Integer SmallInt  
adTinyInt 16 Byte
TinyInt
       
adUnsignedBigInt 21 UInt64
UnsignedBigInt
       
adUnsignedInt 19 UInt32
UnsignedInt
       
adUnsignedSmallInt 18 UInt16
UnsignedSmallInt
       
adUnsignedTinyInt 17 Byte
SqlByte
UnsignedTinyInt
Byte Byte TinyInt  
adUserDefined 132          
adVarBinary 204 Byte[] 
SqlBinary

VarBinary
Variant ReplicationID VarBinary  
adVarChar 200 String
SqlString
VarChar
String Text VarChar VarChar
adVariant 12 Object
Variant
Variant   Sql_Variant VarChar2
adVarNumeric 139 VarNumeric        
adVarWChar 202 String
SqlString

VarWChar
String Text NVarChar NVarChar2
adWChar 130 String
SqlString

WChar
String   NChar  

'MS-SQL' 카테고리의 다른 글

MS-SQL 인덱스 조각모음  (0) 2013.01.03
MS-SQL 전체 테이블 크기 조회 (용량순, 테이블이름순)  (0) 2012.08.16
declare cursor  (0) 2012.06.12
Join절 Update  (0) 2011.11.03
join, update  (0) 2010.11.22

전각/반각 구분하여 문자열 계산

ASP 2010. 10. 5. 16:31 Posted by Dayis
Function chrbyte(str,strlen)
 Dim returnStr, charat, cutchk, wLen, j
 cutchk = 0

 for j=1 to len(str)
  charat=mid(str, j, 1)
  if asc(charat)>0 And asc(charat)<255 Then
   If asc(charat) = 1 Then
    wLen=wLen+2 
   Else
    wLen=wLen+1 
   End If
  Else
   wLen=wLen+2
  end If
  
  returnStr = returnStr & charat

  If wLen >strlen Then
   cutchk = 1
   Exit for
  End if
 Next
 
 If cutchk = 1 then
  chrbyte = returnStr & ".."
 Else
  chrbyte = returnStr
 End if
end Function

'ASP' 카테고리의 다른 글

ASP 파라메터 컨트롤 함수  (0) 2012.01.09
jquery 파일 업로드  (0) 2010.12.10
구글맵  (0) 2010.12.09
구글맵 API Key 생성 URL  (0) 2010.12.01
ASP 배열을 자바스크립트 배열로 변경  (0) 2010.12.01

전각/반각 구분하여 문자열 계산

JAVASCRIPT 2010. 10. 5. 16:31 Posted by Dayis
function OntextCheck(obj)
{
 var str = new String(obj.value);
 var _byte = 0;
 if(str.length != 0)
 {
    for (var i=0; i < str.length; i++)
    {
      var str2 = str.charAt(i);
      if(escape(str2).length > 4)
      {
       _byte += 2;
      }
      else
      {
       _byte++;
      }
    }
 }
 return _byte;
}

'JAVASCRIPT' 카테고리의 다른 글

jQuery.ajax()를 이용한 페이지 실행  (0) 2010.12.21
JQuery select box  (0) 2010.12.20
jquery 오류  (0) 2010.12.09
jquery : 셀렉터  (0) 2010.12.06
jquery : 속도, 페이드인, 애니메이션  (0) 2010.12.06