MyODBC Reference Manual for version 3.51.02
http://www.mysql.com/products/myodbc/manual_toc.html
-------------------------------------------------------------------
<%
on error resume next
dim adoConn
dim adoRS
dim counter
set adoConn = Server.CreateObject("ADODB.Connection")
set adoRS = Server.CreateObject("ADODB.Recordset")
先去MYSQL站点下载MYSQL ODBC驱动,最新3.5版
安装MYSQL ODBC后,建立DSN,就可以调用了!
例如:
Public Function OpenDatabase() As Long
dim cn as New ADODB.Connection
On Error Resume Next
Err.Clear
With cn
.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=temp_data"
.ConnectionTimeout = 10
.CursorLocation = adUseClient
.Open
End With
If Err.Number <> 0 Then 'Failure
OpenDatabase = Err.Number
Else 'Success
OpenDatabase = 0
End If
Set Gbl_DB_Con = New ADODB.Connection
Gbl_DB_Con.Open "Provider = sqloledb;data source=devserver;user ID=sa;initial catalog=test_Excel;password= pass"
建立数据集,
对数据集操作,
关闭数据集。
Dim RS_Get_Form_Name_Array As ADOR.Recordset
Set RS_Get_Form_Name_Array = New ADOR.Recordset
RS_Get_Form_Name_Array.close
set RS_Get_Form_Name_Array =nothing
'数组重定义
ReDim Tmp_P_Sheet_Division_ID_Array(RS_Sheet_Division.RecordCount) As String
ReDim Tmp_P_Sheet_Division_Name_Array(RS_Sheet_Division.RecordCount) As String
'将查询的结果放到私有数组中
For i = 1 To RS_Sheet_Division.RecordCount