我尝试了很多代码,但为什么它不会在数据网格视图中显示? 以下是我的代码:
Dim cmd As New MySqlCommand
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Then
MsgBox("provide all details!")
Else
Try
myconn.Open()
cmd.Connection = myconn
cmd.CommandText = "insert into borrow (ID,StudentName,Code,Book,Author,DateBorrowed,DueDate) values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "' ,'" & DateTimePicker1.Value & "' ,'" & DateTimePicker2.value & "')"
cmd.ExecuteNonQuery()
MsgBox("BOOK BORROWED!")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
DateTimePicker1.Value
DateTimePicker2.Value