기초 DB 연결
페이지 정보
작성자 MintState 댓글 0건 조회 10,500회 작성일 09-10-21 00:25본문
기초 DB 연결
기본적인 MSSQL 연결 방법입니다.
기본적인 MSSQL 연결 방법입니다.
<% Dim strConnect, db, Rs, comm strConnect="Provider=SQLOLEDB;Data Source=(local);Initial Catalog=test2009;user ID=test2009;password=test2009;" 'DB Open Sub openDBConnect(ByVal strConnect) Set db = Server.CreateObject("ADODB.Connection") db.ConnectionTimeout = 6000 db.CommandTimeout = 6000 db.open strConnect End Sub 'DB Close Sub closeDBConnect() db.close Set db = Nothing End Sub 'Open RecordSet Sub openDBRecordSet Set Rs = Server.CreateObject("ADODB.RecordSet") Rs.CursorLocation = adUseClient End Sub 'Close RecordSet Sub closeDBRecordSet Rs.Close Set Rs = Nothing End Sub 'Open DB Command Sub openDBCommand Set comm = Server.CreateObject("ADODB.Command") End Sub 'Close DB Command Sub closeDBCommand Set comm.ActiveConnection = Nothing Set comm = Nothing End Sub call openDBConnect( strConnect ) sql = " select count(b_name) as recCount from MyBoard " Set Rs = db.Execute(sql) recordCount = Rs(0) Response.Write(recordCount) call closeDBRecordSet() call closeDBConnect() %>
|
댓글목록
등록된 댓글이 없습니다.