我的连接字符串如下。
conn.ConnectionString = "Server=192.248.***.***; Port=3036; User id=admin; password=***; Database=abc; Connect Timeout=60;"
Run Code Online (Sandbox Code Playgroud)
但它返回错误“连接到数据库时出错:无法连接到任何指定的 MySQL 主机。”
但我可以使用 PHPMyAdmin 登录。
//192.248.***.***/phpmyadmin
Run Code Online (Sandbox Code Playgroud)
我还可以使用以下命令登录本地 MySQL 数据库:
conn.ConnectionString = "server=" & "localhost" & ";" & "user id=" & "admin" & ";" & "password=" & "" & ";" & "database=abc"
Run Code Online (Sandbox Code Playgroud)
这段代码有什么问题。我想连接到远程数据库,因为这是系统的要求。请提供任何帮助。
更新: 在立即窗口中显示:
PassbookPrinter.vshost.exe Error: 0 : Unable to connect to any of the specified MySQL hosts.
A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll
Run Code Online (Sandbox Code Playgroud) 如何查看今天的天气是一年中的第一天或不是在PHP.
编辑:回音日期('Ym-d',strToTime('今年'1/1'));
这段代码给了我结果.这是有效还是有更好的方式.