YesYo.com MintState Forums
뒤로    YesYo.com MintState BBS > Tech > ASP
검색
멤버이름    오토
비밀번호 
 

기초 DB 연결

페이지 정보

작성자 MintState 댓글 0건 조회 10,192회 작성일 09-10-21 00:25

본문

기초 DB 연결

기본적인 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()
%>

댓글목록

등록된 댓글이 없습니다.

Total 5건 1 페이지
ASP 목록
번호 제목 글쓴이 조회 날짜
5 MintState 16786 05-24
4 MintState 9968 05-24
3 MintState 17889 04-12
열람중 MintState 10193 10-21
1 MintState 12719 10-20
게시물 검색

모바일 버전으로 보기
CopyRight ©2004 - 2024, YesYo.com MintState. ™