Connection Command Recordset Connection SQL Connection String Open

  • Slides: 33
Download presentation
Ⅰ. Connection 개체 Ⅱ. Command 개체 Ⅲ. Recordset 개체

Ⅰ. Connection 개체 Ⅱ. Command 개체 Ⅲ. Recordset 개체

Connection 개체 - 데이터베이스로의 연결과 SQL 질의를 수행 - Connection. String - Open, Close,

Connection 개체 - 데이터베이스로의 연결과 SQL 질의를 수행 - Connection. String - Open, Close, Exute

Connection 개체 개체 생성 Set Conn_asp_db = Server. Create. Object(“ADODB. Connection”) Server 개체의 Create.

Connection 개체 개체 생성 Set Conn_asp_db = Server. Create. Object(“ADODB. Connection”) Server 개체의 Create. Object 메소드 에게 Prog. ID가 ADODB. Connection인 Conn_asp_db라는 이름의 Connection 개체를 생성

Connection 개체 Sub application_On. Start() set Application(“Conn_asp_db”)= server. Create. Object(“ADODB. Connection”) End Sub Session_On.

Connection 개체 Sub application_On. Start() set Application(“Conn_asp_db”)= server. Create. Object(“ADODB. Connection”) End Sub Session_On. Start() set Session(“Conn_asp_db”)= server. Create. Object(“ADODB. Connection”) End Sub <Object Run. At=Server Scope=Application ID=Conn_asp_db Prog. ID=“ADODB. Connection”> </Object> <Object Run. At=Server Scope=Session ID=Conn_asp_db Prog. ID=“ADODB. Connection”> </Object>

Connection 개체 데이터베이스 연결 - Open 메소드를 이용하여 ODBC DSN에 연결 Connection_Object_name. Open Connection.

Connection 개체 데이터베이스 연결 - Open 메소드를 이용하여 ODBC DSN에 연결 Connection_Object_name. Open Connection. String, User. ID, Password, Options

Connection 개체 데이터베이스 연결 1. Conn_asp_db. Open “DSN=asp_db_DSN; User=sunhee; Password= abcd 1234” 2. Conn_asp_db.

Connection 개체 데이터베이스 연결 1. Conn_asp_db. Open “DSN=asp_db_DSN; User=sunhee; Password= abcd 1234” 2. Conn_asp_db. Open “asp_db_DSN”, ”sunhee”, ”abcd 1234” 3. Conn_asp_db. Connection. String = “DSN=asp_db_DSN; User=sunhee; Password =abcd 1234” Conn_asp_db. Open

Connection 개체 데이터베이스 질의 - Execute 메소드를 이용 Connection_Object_name. Execute Command. Text, Record. Affected,

Connection 개체 데이터베이스 질의 - Execute 메소드를 이용 Connection_Object_name. Execute Command. Text, Record. Affected, Options SQL 질의 텍스트 Command. Text의 종류 수행 결과 영향 받은 레코드의 수

Connection 개체 데이터베이스 질의 예 Conn_asp_db. Execute “Insert Into Student(Hakbun, Name, age) Values(200112345, ‘김송이’,

Connection 개체 데이터베이스 질의 예 Conn_asp_db. Execute “Insert Into Student(Hakbun, Name, age) Values(200112345, ‘김송이’, 20)”, count, 1 추가된 레코드 수가 count 변수에 저장 되며, Option 부분의 값이 1이므로 Command. Text의 내용이 SQL 질의 임을 알 수 있음

Connection 개체 데이터베이스 질의 예 Set rs = Conn_asp_db. Execute “Select * From Student”

Connection 개체 데이터베이스 질의 예 Set rs = Conn_asp_db. Execute “Select * From Student” Execute의 실행 결과를 rs에 받아두게 됨. 이 rs는 Record. Set으로 사용됨

Command 개체 - 데이터베이스로의 연결과 SQL 질의를 수행 - Active. Cpnnection, Command. Text, Command.

Command 개체 - 데이터베이스로의 연결과 SQL 질의를 수행 - Active. Cpnnection, Command. Text, Command. Type - Execute

Command 개체 종류 메 소 드 이름 Execute 설명 Command. Text 속성에서 지정한 SQL

Command 개체 종류 메 소 드 이름 Execute 설명 Command. Text 속성에서 지정한 SQL 문장이나 Stored Procedure를 실행

Command 개체 개체 생성 Set Comm_asp_db = Server. Create. Object(“ADODB. Comman d”) Server 개체의

Command 개체 개체 생성 Set Comm_asp_db = Server. Create. Object(“ADODB. Comman d”) Server 개체의 Create. Object 메소드에 Prog. ID가 ADODB. Command인 Comm_asp_db라는 이름의 Command 개체를 생성

Command 개체 데이터베이스 연결 - Active. Connection 속성을 이용하여 연결 : 미리 생성되어 있는

Command 개체 데이터베이스 연결 - Active. Connection 속성을 이용하여 연결 : 미리 생성되어 있는 Connection 개체를 이용 Command_Object_Name. Active. Connection = Connection_Object_Name

Command 개체 데이터베이스 연결 - Active. Connection 속성을 이용하여 연결 : DSN의 이름을 이용

Command 개체 데이터베이스 연결 - Active. Connection 속성을 이용하여 연결 : DSN의 이름을 이용 Command_Object_Name. Active. Connecti on = DSN_Name : 연결스트링을 이용 Command_Object_Name. Active. Connecti on = Connection_String

Command 개체 데이터베이스 질의 - 필요한 여러 옵션을 지정한 후 Execute 메소드를 수행 Comm_asp_db.

Command 개체 데이터베이스 질의 - 필요한 여러 옵션을 지정한 후 Execute 메소드를 수행 Comm_asp_db. Command. Text = “Select * From Student” Comm_asp_db. Command. Type = 1 Comm_asp_db. Execute

Recordset 개체 개체 생성 : connection 개체 사용 Set Conn_asp_db = Server. Create. Object(“ADODB.

Recordset 개체 개체 생성 : connection 개체 사용 Set Conn_asp_db = Server. Create. Object(“ADODB. Connection”) Conn_asp_db. Open “asp_db_DSN”, “sunhee”, “abcd 1234” Set rs = Conn_asp_db. Execute “Select * From Student” Connection 개체를 이용하여 Recordset 개체를 생성

Recordset 개체 개체 생성 : Command 개체 사용 Set Comm_asp_db = Server. Create. Object(“ADODB.

Recordset 개체 개체 생성 : Command 개체 사용 Set Comm_asp_db = Server. Create. Object(“ADODB. Command”) Comm_asp_db. Active. Connection = Conn_asp_db Comm_asp_db. Command. Text = “Select * From Student” Comm_asp_db. Command. Type = 1 Set rs = Comm_asp_db. Execute Command개체를 이용하여 Recordset 개체를 생성