level 1
试试
Public cnStr As String = "server=yourIP;port=yourPort;Initial Catalog=数据库名;Integrated Security=False;uid=账号;pwd=密码; pooling=false;CharSet=utf8"
Public cn As MySqlConnection = New MySqlConnection(cnStr)
Public Function UpSQL(ByVal sqlstr As String) As Boolean
Try
If cn.State = ConnectionState.Closed Then
cn.Open()
Dim mSQLcomm As MySqlCommand = New MySqlCommand(strSQL, cn)
mSQLcomm.ExecuteNonQuery()
mSQLcomm.Dispose()
End If
cn.Close()
UpSQL = True
Catch ex As Exception
If cn.State = ConnectionState.Open Then
cn.Close()
End If
UpSQL = False
End Try
Return UpSQL
End Function
2019年08月23日 01点08分
