Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- javascript
- form
- PHP GCM
- 크로스 컴파일
- Injection
- utf-8
- lsusb
- 커널
- SQL Injection
- 시놀로지
- FileSystemObject
- Getrows
- RTL88x2BU
- ASP
- euc-kr
- 무선랜카드
- DS718+
- jquery 레이어
- println
- replace
- 따라다니는 배너
- ajax
- XMLHTTP
- disabled
- synology
- readonly
- include
- submit
- AC1300
- jQuery
Archives
- Today
- Total
아는 것이 좋은 것이다.
[MYSQL] asp에서 mysql 연동, 데이터 불러오기 본문
http://dev.mysql.com/downloads/connector/odbc/ <-여기에서 ODBC를 설치후 서버에 연결할 mysql을 셋팅해준후 아래의 소스로 연결이 됐는지를 확인한다.
<%
'// <OBJECT> 태그를 이용한 ODBC 연결
%>
<OBJECT RUNAT="server" PROGID="ADODB.Connection" id="dbconn"></OBJECT>
<OBJECT RUNAT="server" PROGID="ADODB.Recordset" id="rs"></OBJECT>
<%
'//-----------------------------------------------------------------//
'MYSQL ODBC Connection 문자열
'DSN -- ODBC DSN, UID -- 데이타베이스 사용자, PWD -- 데이타베이스 비밀번호
dbconn.Open("DSN=connector;UID=root;PWD=pass;")
'//-----------------------------------------------------------------//
if dbconn.errors.count = 0 then
response.write "Connected Successfully!<br><br>"
Else
Response.write "Fail!!<br><br>"
end if
sql = "select * from table limit 0, 200;"
rs.open sql,dbconn
If Not(rs.bof Or rs.eof) Then arrRS = rs.getrows()
rs.close
dbconn.close ' nothing 은 안해줘도 된다. (OBJECT 선언을 하였기 떄문에)
If IsArray(arrRS) Then
Response.write "<table border=""1"" cellpadding=""3"">"
For i = 0 To UBound(arrRS,2)
Response.write "<tr>"
Response.write "<td>" & arrRS(0,i) & "</td>"
Response.write "<td>" & arrRS(1,i) & "</td>"
Response.write "<td>" & arrRS(2,i) & "</td>"
Response.write "<td>" & arrRS(3,i) & "</td>"
Response.write "<td>" & arrRS(4,i) & "</td>"
Response.write "<td>" & arrRS(5,i) & "</td>"
Response.write "<td>" & arrRS(6,i) & "</td>"
'Response.write "<td>" & arrRS(7,i) & "</td>"
'Response.write "<td>" & arrRS(8,i) & "</td>"
'Response.write "<td>" & arrRS(9,i) & "</td>"
'Response.write "<td>" & arrRS(10,i) & "</td>"
'Response.write "<td>" & arrRS(11,i) & "</td>"
Response.write "<tr>"
Next
Response.write "</table>"
Else
Response.write "데이터가 없습니다.<br>"
End If
Set arrRS = nothing
%>
'DB' 카테고리의 다른 글
[MYSQL] 웹이나 SELECT 조회시 한글 깨질경우 (0) | 2015.12.25 |
---|---|
[MSSQL] 다른서버 DB 접속하여 select 하기 (0) | 2014.07.14 |
[MSSQL] 페이징 기능 성능 향상,개선 (0) | 2014.07.04 |
[MSSQL] 데이터 암호화, 복호화 - MD5 (0) | 2014.07.02 |
[MSSQL] 다른 DB내용 가져오기 (0) | 2014.06.18 |
Comments