欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

excel數(shù)據(jù)導(dǎo)入mysql,vba怎么將excel數(shù)據(jù)插入mysql數(shù)庫(kù)庫(kù)

excel數(shù)據(jù)導(dǎo)入mysql,vba怎么將excel數(shù)據(jù)插入mysql數(shù)庫(kù)庫(kù)?

1、定義連接db的過(guò)程:Dim oConn As ADODB.ConnectionPrivate Sub ConnectDB() Set oConn = New ADODB.Connection oConn.Open "DRIVER={mysql ODBC 5.1 Driver};" & _ "SERVER=localhost;" & _ "DATABASE=yourdatabase;" & _ "USER=yourdbusername;" & _ "PASSWORD=yourdbpassword;" & _ "Option=3"End Sub2、執(zhí)行db插入的具體寫(xiě)法:Dim rs As ADODB.RecordsetPrivate Sub InsertData() Set rs = New ADODB.Recordset ConnectDB With wsBooks For rowCursor = 2 To 11 strSQL = "INSERT INTO tutorial (author, title, price) " & _ "VALUES ('" & esc(.Cells(rowCursor, 1)) & "', " & _ "'" & esc(.Cells(rowCursor, 2)) & "', " & _ esc(.Cells(rowCursor, 3)) & ")" rs.Open strSQL, oConn, adOpenDynamic, adLockOptimistic Next End WithEnd Sub