update database and reflect changes in grid
Posted on 2006-04-13
Hi, im trying to update a field in the database and reflect those changes in a datagrid without having to fill the dataset
Here is what is was doing before:
Dim strSQL As String
Dim cmd As New SqlCeCommand
Dim da as new SqlceDataadapter
strSQL = "UPDATE Detail SET Level = ? WHERE FK_ID = ?"
.Connection = PW_DS.cn
.CommandText = strSQL
.CommandType = CommandType.Text
.Parameters.Add("@Level", SqlDbType.Decimal, 8, "Level").value = 500
.Parameters.Add("@FK_ID", SqlDbType.SmallInt, 8, "FK_ID").value = 100
'..here check connection state and open
Until here, fine. But i was wondering how can i update the query to modify various fields, in the database, at the same time and show those changes in the grid without filling again.
I was using the dataadapter but i ddint update anything if i removed the line cmd.executenonquery.
.UpdateCommand = cmd
' .UpdateCommand.Parameters("@DatumLevel").Value = 222
'.UpdateCommand.Parameters("@FK_ID").Value = 170
How can i get this to work?