gpt4 book ai didi

mysql - 无法在 VB.NET 中使用 MySQL 显示记录

转载 作者:行者123 更新时间:2023-11-30 22:26:31 28 4
gpt4 key购买 nike

Imports MySql.Data.MySqlClient


Public Class home1
Dim id As String
Dim name1 As String
Dim name2 As String
Dim address As String
Dim age As Integer
Dim gender As String
Dim bday As Date
Dim height1 As String
Dim weight1 As String
Dim crimcase As String
Dim eye As String
Dim con As New MySqlConnection
Dim source1 As New BindingSource()
Dim source2 As New BindingSource()
Dim ds As DataSet = New DataSet
Dim tables As DataTableCollection = ds.Tables




Private Sub home1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try

con.ConnectionString = "Server=localhost;User Id=root;Password='';Database=db_criminalrecord"
Catch ex As Exception
MsgBox(ex.Message)




End Try
fill()

End Sub

Public Sub fill()
Dim dt As New DataTable
Dim str As String = "SELECT ID,Criminal_Name,Alias,Address,Age,Gender,Height,Weight,Date_of_Birth,criminal_Case,Eye_Colour "
Dim da As New MySqlDataAdapter(str, con)
da.Fill(dt)
da.Dispose()
source1.DataSource = dt
DataGridView1.DataSource = dt
DataGridView1.Refresh()
DataGridView1.Columns(13).Width = 150

End Sub

Sub clear()

TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
End Sub



End Class

最佳答案

您的选择语句不包含 FROM TABLE_NAME 部分。

关于mysql - 无法在 VB.NET 中使用 MySQL 显示记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35066481/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com