C
copyco
I'm having trouble with a datagrid. The problem is that after updating
my table with the command object, the changes to the table are not being
reflected in the datagrid. I have determined that before I can refill
the dataset, the changes to the table haven't actually taken place yet,
so the old data goes back into the datagrid. The only work-around to
this problem is to put the application to sleep long enough for the
command object to work, then after the sleep period, the dataset can be
filled with the new and changed data. Is there a more tidy, less sloppy
way of dealing with this problem? BTW this is a windows form datagrid,
not a webpage datagrid. The code is below.
cmNumbers.CommandText = "insert into numbers " & _
"([number], comName, callCount, lastCall) values " & _
"('" & comNum & "', '" & comName & "', 1, '" & vNow & "')"
cmNumbers.ExecuteNonQuery()
'** without the following line, my datagrid doesn't refresh!!
System.Threading.Thread.Sleep(500)
dsNumbers.Clear()
daNumbers.Fill(dsNumbers, "Numbers")
my table with the command object, the changes to the table are not being
reflected in the datagrid. I have determined that before I can refill
the dataset, the changes to the table haven't actually taken place yet,
so the old data goes back into the datagrid. The only work-around to
this problem is to put the application to sleep long enough for the
command object to work, then after the sleep period, the dataset can be
filled with the new and changed data. Is there a more tidy, less sloppy
way of dealing with this problem? BTW this is a windows form datagrid,
not a webpage datagrid. The code is below.
cmNumbers.CommandText = "insert into numbers " & _
"([number], comName, callCount, lastCall) values " & _
"('" & comNum & "', '" & comName & "', 1, '" & vNow & "')"
cmNumbers.ExecuteNonQuery()
'** without the following line, my datagrid doesn't refresh!!
System.Threading.Thread.Sleep(500)
dsNumbers.Clear()
daNumbers.Fill(dsNumbers, "Numbers")