当前位置:   article > 正文

VB从MySQLDB检索数据以及写入数据_imports mysql.data.mysqlclient imports system.data

imports mysql.data.mysqlclient imports system.data.sqlclient


VB与MySQL连接及数据写入和检索

1.VB 代码

-----------------------------------------------------------------------------------------

'System.Data.SqlClient
Imports MySql.Data.MySqlClient

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'On Error GoTo Err1
        Dim pubsSQLConn As MySqlConnection   'db 连接
        Dim conStr As String
        pubsSQLConn = New MySqlConnection

        conStr = "server=localhost;user id=root;pwd=root;database=vb;port=3306"  '连接字符串
        pubsSQLConn.ConnectionString = conStr
        pubsSQLConn.Open()

        Dim tr As MySqlTransaction = pubsSQLConn.BeginTransaction '事务
        Dim sql As String
        sql = "select * from user" '如果是select之

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/203388?site
推荐阅读
相关标签
  

闽ICP备14008679号