asp 에서 mysql 접속방법

[oledb 로 접속할 경우]
mysql.com 에 접속해서 oledb 다운받아 설치


<%
strcon = "Provider=MySqlProv;Location=아이피;Data Source=디비명;User ID=아이디;Password=비밀번호;"
set DbCon = Server.CreateObject("ADODB.Connection")
DbCon.open strcon
%>

SQL_query = "SELECT count(*) FROM 테이블명"
Set RS = DbCon.Execute(SQL_query)

Response.Write " Query : " + SQL_query + "

"
Response.Write " Result : "

while not RS.eof
Response.Write RS(0)
Response.Write "
"
RS.MoveNext
wend

RS.Close
DbCon.Close

set RS = nothing
set DbCon = nothing



[odbc 로 접속할 경우]
mysql.com 에 접속해서 myodbc 다운받아 설치


<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "mysql"
SQL_query = "SELECT * FROM your_table WHERE your_field LIKE '%abc%';"
Set RS = MyConn.Execute(SQL_query)
%>


Document Title




<% Response.Write SQL_query %>



<%while not RS.eof%>
<%=RS("FIELD1")%> <%=RS("FIELD2")%> <%=RS("FIELD3")%>

<%RS.MoveNext%>
<%wend%>

<%
RS.Close
MyConn.Close
%>

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2008/05/28 17:47 2008/05/28 17:47
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/3315

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/3315

« Previous : 1 : ... 3114 : 3115 : 3116 : 3117 : 3118 : 3119 : 3120 : 3121 : 3122 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/05   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Statistics Graph

Site Stats

Total hits:
197443
Today:
331
Yesterday:
857