<tfoot id='CEKSt'></tfoot>

    <legend id='CEKSt'><style id='CEKSt'><dir id='CEKSt'><q id='CEKSt'></q></dir></style></legend>

      <small id='CEKSt'></small><noframes id='CEKSt'>

      • <bdo id='CEKSt'></bdo><ul id='CEKSt'></ul>
    1. <i id='CEKSt'><tr id='CEKSt'><dt id='CEKSt'><q id='CEKSt'><span id='CEKSt'><b id='CEKSt'><form id='CEKSt'><ins id='CEKSt'></ins><ul id='CEKSt'></ul><sub id='CEKSt'></sub></form><legend id='CEKSt'></legend><bdo id='CEKSt'><pre id='CEKSt'><center id='CEKSt'></center></pre></bdo></b><th id='CEKSt'></th></span></q></dt></tr></i><div id='CEKSt'><tfoot id='CEKSt'></tfoot><dl id='CEKSt'><fieldset id='CEKSt'></fieldset></dl></div>

    2. VBA如何在Excel中连接MySQL数据库?

      How can VBA connect to MySQL database in Excel?(VBA如何在Excel中连接MySQL数据库?)

      <small id='FBN3p'></small><noframes id='FBN3p'>

        <legend id='FBN3p'><style id='FBN3p'><dir id='FBN3p'><q id='FBN3p'></q></dir></style></legend><tfoot id='FBN3p'></tfoot>
          <tbody id='FBN3p'></tbody>

            <i id='FBN3p'><tr id='FBN3p'><dt id='FBN3p'><q id='FBN3p'><span id='FBN3p'><b id='FBN3p'><form id='FBN3p'><ins id='FBN3p'></ins><ul id='FBN3p'></ul><sub id='FBN3p'></sub></form><legend id='FBN3p'></legend><bdo id='FBN3p'><pre id='FBN3p'><center id='FBN3p'></center></pre></bdo></b><th id='FBN3p'></th></span></q></dt></tr></i><div id='FBN3p'><tfoot id='FBN3p'></tfoot><dl id='FBN3p'><fieldset id='FBN3p'></fieldset></dl></div>

                <bdo id='FBN3p'></bdo><ul id='FBN3p'></ul>
                本文介绍了VBA如何在Excel中连接MySQL数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                Dim oConn As ADODB.Connection
                Private Sub ConnectDB()
                Set oConn = New ADODB.Connection
                Dim str As String
                str = "DRIVER={MySQL ODBC 5.2.2 Driver};" & _
                                                            "SERVER=sql100.xtreemhost.com;" & _
                                                            "PORT=3306" & _
                                                            "DATABASE=xth_9595110_MyNotes;" & _
                                                            "UID=xth_9595110;" & _
                                                            "PWD=myPassword;" & _
                                                            "Option=3"
                ''' error '''
                oConn.Open str
                End Sub
                
                Private Sub InsertData()
                Dim rs As ADODB.Recordset
                Set rs = New ADODB.Recordset
                ConnectDB
                sql = "SELECT * FROM ComputingNotesTable"
                rs.Open sql, oConn, adOpenDynamic, adLockOptimistic
                Do Until rs.EOF
                    Range("A1").Select
                    ActiveCell = rs.Fields("Headings")
                    rs.MoveNext
                Loop
                rs.Close
                oConn.Close
                Set oConn = Nothing
                Set rs = Nothing
                End Sub
                

                在PHP中做类似的事情,我可以成功登录到MySQL服务器.我已经安装了 ODBC 连接器.但是在上面的 VBA 代码中,我失败了.出现错误.(查看存在错误的代码)

                Doing the similar things in PHP, I could successfully log in to the MySQL server. I have installed the ODBC connector. But in the above VBA codes, I failed. An error turns up. (see the codes where the error exists)

                $connect = mysql_connect("sql100.xtreemhost.com","xth_9595110","myPassword") or die(mysql_error());
                
                mysql_select_db("myTable",$connect);
                

                推荐答案

                Ranjit 的代码导致了与 Tin 报告的相同的错误消息,但在使用我正在运行的 ODBC 驱动程序更新 Cn.open 后仍然有效.检查 ODBC 数据源管理器中的驱动程序选项卡.我的说MySQL ODBC 5.3 Unicode 驱动程序"所以我相应地更新了.

                Ranjit's code caused the same error message as reported by Tin, but worked after updating Cn.open with the ODBC driver I'm running. Check the Drivers tab in the ODBC Data Source Administrator. Mine said "MySQL ODBC 5.3 Unicode Driver" so I updated accordingly.

                这篇关于VBA如何在Excel中连接MySQL数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Bogus foreign key constraint fail(虚假外键约束失败)
                how to get last insert id after insert query in codeigniter active record(如何在codeigniter活动记录中插入查询后获取最后一个插入ID)
                Force InnoDB to recheck foreign keys on a table/tables?(强制 InnoDB 重新检查表/表上的外键?)
                How to auto generate migrations with Sequelize CLI from Sequelize models?(如何使用 Sequelize CLI 从 Sequelize 模型自动生成迁移?)
                Clear MySQL query cache without restarting server(无需重启服务器即可清除 MySQL 查询缓存)
                ALTER TABLE to add a composite primary key(ALTER TABLE 添加复合主键)
              • <small id='NUv79'></small><noframes id='NUv79'>

              • <tfoot id='NUv79'></tfoot>
                      <legend id='NUv79'><style id='NUv79'><dir id='NUv79'><q id='NUv79'></q></dir></style></legend>
                          <bdo id='NUv79'></bdo><ul id='NUv79'></ul>
                          <i id='NUv79'><tr id='NUv79'><dt id='NUv79'><q id='NUv79'><span id='NUv79'><b id='NUv79'><form id='NUv79'><ins id='NUv79'></ins><ul id='NUv79'></ul><sub id='NUv79'></sub></form><legend id='NUv79'></legend><bdo id='NUv79'><pre id='NUv79'><center id='NUv79'></center></pre></bdo></b><th id='NUv79'></th></span></q></dt></tr></i><div id='NUv79'><tfoot id='NUv79'></tfoot><dl id='NUv79'><fieldset id='NUv79'></fieldset></dl></div>
                            <tbody id='NUv79'></tbody>