- 通过https://sourceforge.net/projects/mysqldrivercs/下载MysqLDriverCS安装程序,安装到本地电脑上,(后续不需要每台电脑都安装此程序),找到安装位置中的dll文件夹,
- 在.net程序中引用上面文件夹中的MysqLDriverCS.dll文件,并在代码中导入,并把 MysqLDriverCS.dll, libMysqL.dll,libMysqL-4.0.dll拷贝到项目文件夹中
Imports MysqLDriverCS
3.
Try
Dim MysqL As String = "Location=10.*.*.*;User Id=root;Data Source=;Port=3306;Password="
Dim Connection As New MysqLConnection(MysqL)
Connection.open()
Dim sql As String = "insert into technologydept_onlinemackey set mainboardID='123456',test_time=Now()"
Dim command As MysqLCommand = New MysqLCommand(sql,Connection)
command.ExecuteNonQuery()
command.dispose()
Connection.Close()
MsgBox("OK")
Catch ex As Exception
MsgBox(ex.Message)
End Try