|
- Sub db()
-
- Dim lngRow As Long, arrID As Variant, strID As String
-
- Dim conn As ADODB.Connection
- Dim rs As ADODB.Recordset
-
- lngRow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
- If lngRow < 2 Then Exit Sub
-
- arrID = Sheet1.Range("A2:A" & lngRow)
- arrID = Application.WorksheetFunction.Transpose(arrID)
- strID = "'" & Join(arrID, "','") & "'"
-
- Set conn = New ADODB.Connection
- Set rs = New ADODB.Recordset
- conn.ConnectionString = "Driver={MySQL ODBC 8.0 Unicode Driver};Server=192.168.0.198;DB=saas;UID=root;PWD=12345;OPTION=3;"
- conn.Open
- rs.Open "select * from`daily_hco_full_info` where 机构id in values(" & strID & ")", conn
- [B2].CopyFromRecordset rs
- rs.Close: Set rs = Nothing
- conn.Close: Set conn = Nothing
- MsgBox "处理完毕", vbOKOnly, "提示信息"
-
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|