【发布时间】:2019-10-05 11:06:10
【问题描述】:
我尝试了我能做的一切——我是编程的初学者。我想使用 VB 或 Visual Studio 在 xampp 中更新我的数据库,但似乎做不到。
这是我的表单代码。:
Imports MySql.Data.MySqlClient
Public Class Form4
Public MysqlConn As MySqlConnection
Public cmd As New MySqlCommand
Public da As New MySqlDataAdapter
Public Sub MysqlConnection()
MysqlConn = New MySqlConnection()
'Connection String
MysqlConn.ConnectionString = "server=localhost;" _
& "user id=root;" _
& "password=;" _
& "database=bank"
'OPENING THE MysqlConnNECTION
MysqlConn.Open()
End Sub
Public Sub add()
Dim sql As String
Dim TempTable As New DataTable
sql = "update cbank set Balance = Balance + " & TextBox2.Text & "where AccountID = " & TextBox1.Text & "and PIN = " & TextBox3.Text & ";"
'bind the connection and query
With cmd
.Connection = MysqlConn
.CommandText = sql
End With
da.SelectCommand = cmd
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
MysqlConnection()
add()
End Sub
End Class
没有错误只是没有输出也没有
【问题讨论】:
-
我在您的问题中看不到与 xampp 的连接。它看起来像在 vb.net 代码中使用的纯 ADO.net。 Vb.net 是编程语言。 Visual Studio 是一个集成开发环境 (IDE),您可以在其中使用多种不同的语言进行编码。