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


 
작성일 : 09-10-21 00:25
기초 DB 연결
 글쓴이 : MintState
조회 : 4,807  
기초 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()
%>
Rated 3.0/5 (60%) (1 Votes)

(\__/)
(='.'=)
(")_(")~
Search Infomation by MintState
MintState

 
 

Total 5
번호 제   목 글쓴이 날짜 조회
5 성능 및 스타일 향상에 도움이 되는 28가지 ASP 팁 MintState 05-24 5492
4 UTF-8 EUC-KR CODEPAGE MintState 05-24 4559
3 MSSQL 트랜잭션 로그 백업(Transaction Log Backup)에 관하여 MintState 04-12 5455
2 기초 DB 연결 MintState 10-21 4808
1 ASP INFO MintState 10-20 4495

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