按钮代码
Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Mysqlconnection = New SqlConnection
Mysqlconnection.ConnectionString = "Server=CTJY\SQLSERVER;Database=WinningAcademyDB;Integrated Security=true;"
Dim reader As SqlDataReader
Mysqlconnection.Open()
Dim query As String
query = "update Grade set Girdview4_col3 = '" & DropDownList2.SelectedValue & "' "
command = New SqlCommand(query, Mysqlconnection)
reader = command.ExecuteReader
End Sub
每次单击该按钮时,“成绩”列中的所有内容都会更改,并且完全相同。我只希望更改所选项目的成绩。不是全部。
答案 0 :(得分:0)
你可以使用 where 来选择那些网格..也就是说,在datagrid中创建一个关于单元格选择的事件的函数,并为的 where子句填充一个字符串> sql 声明..