我想在DATEGRID里面编辑数据进行更新,在属性生成器里面应该怎么设置啊,谁有这方面的资料,发一个看看,感谢啊!!!
在更新的时间中
Dim objcmd As OleDbCommand
Dim TextBoxInGrid As TextBox
Dim newXingming, newzhiwei, newjianjie, newxueli, newsex, newqita, newlianxi As String
Dim strUpdate As String = "update zhaoping set 公司=@newXingming,职位=@newzhiwei,工作简介=@newjianjie,学历=@newxueli,要求性别=@newsex,其他要求=@newqita,联系方式=@newlianxi where ID=" & DataGrid1.DataKeys(e.Item.ItemIndex)
TextBoxInGrid = CType(e.Item.Cells(0).Controls(0), TextBox)
newXingming = TextBoxInGrid.Text
TextBoxInGrid = CType(e.Item.Cells(1).Controls(0), TextBox)
newzhiwei = TextBoxInGrid.Text
TextBoxInGrid = CType(e.Item.Cells(2).Controls(0), TextBox)
newjianjie = TextBoxInGrid.Text
TextBoxInGrid = CType(e.Item.Cells(3).Controls(0), TextBox)
newxueli = TextBoxInGrid.Text
TextBoxInGrid = CType(e.Item.Cells(4).Controls(0), TextBox)
newsex = TextBoxInGrid.Text
TextBoxInGrid = CType(e.Item.Cells(5).Controls(0), TextBox)
newqita = TextBoxInGrid.Text
TextBoxInGrid = CType(e.Item.Cells(6).Controls(0), TextBox)
newlianxi = TextBoxInGrid.Text
Dim conn As OleDbConnection
conn = New System.Data.OleDb.OleDbConnection("Provider= Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database\wz.mdb"))
conn.Open()
objcmd = New OleDbCommand(strUpdate, conn)
objcmd.Parameters.Add("@newXingming", OleDbType.VarChar)
objcmd.Parameters("@newXingming").Value = newXingming
objcmd.Parameters.Add("@newzhiwei", OleDbType.VarChar)
objcmd.Parameters("@newzhiwei").Value = newzhiwei
objcmd.Parameters.Add("@newjianjie", OleDbType.VarChar)
objcmd.Parameters("@newjianjie").Value = newjianjie
objcmd.Parameters.Add("@newxueli", OleDbType.VarChar)
objcmd.Parameters("@newxueli").Value = newxueli
objcmd.Parameters.Add("@newsex", OleDbType.VarChar)
objcmd.Parameters("@newsex").Value = newsex
objcmd.Parameters.Add("@newqita", OleDbType.VarChar)
objcmd.Parameters("@newqita").Value = newqita
objcmd.Parameters.Add("@newlianxi", OleDbType.VarChar)
objcmd.Parameters("@newlianxi").Value = newlianxi
objcmd.ExecuteNonQuery()
conn.Close()
DataGrid1.EditItemIndex = -1
bindData()