datagrid中更新不了呀
我用的代码如下,帮我看看吧,我搞了好久了
Dim emptid As String = DataGrid1.DataKeys(e.Item.ItemIndex)
Dim newscorse As TextBox = e.Item.FindControl("TextBox1")
Dim myconnecton As SqlConnection = New SqlConnection("server=localhost;uid=sa;database=ppzzjj")
Dim sql As String
sql = "update zl set scorse='" & newscorse.Text & "' where id='" & emptid.ToString & "'"
Dim mycommand As SqlCommand = New SqlCommand(sql, myconnecton)
myconnecton.Open()
mycommand.ExecuteNonQuery()
myconnecton.Close()