J Trahair
Well-known member
Hi. I have an unbound datagridview showing 6 or 7 user names and details.
I have a delete button for deleting a user record, followed by the procedures which re-display the data without the deleted user.
The problem is, it happens so fast that the re-displayed data still includes the deleted user. When I run the SetUpGrd1()/FillGrd1() procedures by themselves again, the deleted user has gone.
Is there a 'hurry up and write this data' routine which I can insert before the Call SetUpGrd1()? Thank you.
I should add, I've tried cmd.ExecuteScalar() and cmd.ExecuteNonQuery(), with the same effect. Hence one being commented out.
I have a delete button for deleting a user record, followed by the procedures which re-display the data without the deleted user.
VB.NET:
objConn = New OleDb.OleDbConnection(mstrOLEConnectionString)
objConn.Open()
Dim cmd As New System.Data.OleDb.OleDbCommand("", objConn)
cmd.CommandTimeout = 60
cmd.Connection = objConn
cmd.CommandType = CommandType.Text
cmd.CommandText = "DELETE FROM Users WHERE UserName = '" & grd1.Item(1, grd1.CurrentCellAddress.Y).Value.ToString & "'"
'cmd.ExecuteScalar()
cmd.ExecuteNonQuery()
Call SetUpGrd1() 'clears the existing data from dgv
Call FillGrd1() 're-populates dgv from database
Is there a 'hurry up and write this data' routine which I can insert before the Call SetUpGrd1()? Thank you.
I should add, I've tried cmd.ExecuteScalar() and cmd.ExecuteNonQuery(), with the same effect. Hence one being commented out.