JamesBrian
asked on
Updating data in database / datagrid
Hi all,
I fill my datagrid using this code :
Private Sub LoadData()
'Construct data adapter
SelectCmdString = "select * from SMSQUEUE WHERE Acknowledged=0 order by SMSQueueID"
da = New SqlDataAdapter(SelectCmdSt ring, conn)
da.Fill(ds, "SMSQUEUE")
LabelID.DataBindings.Add(" Text", ds, "SMSQUEUE.smsqueueid")
LabelDate.DataBindings.Add ("Text", ds, "SMSQUEUE.createdon")
LabelDestination.DataBindi ngs.Add("T ext", ds, "SMSQUEUE.destination")
LabelDescription.DataBindi ngs.Add("T ext", ds, "SMSQUEUE.description")
DataGrid1.SetDataBinding(d s, "SMSQUEUE")
Timer1.Interval = CInt(myInterval) * 1000
Timer1.Enabled = True
End Sub
This gives a Datagrid with 13 columns
I only want the 8th column to be editable(boolean, so just click on/off)
If the checkin this row has been changed, I need to update the 1st and 5th column with a timestamp and the user that performed the update.
I also need to be able to do this in batch.
Now, I am saving changes to other columns in batch like this :
SelectCmdString = "select * from SMSQUEUE WHERE Acknowledged=0 order by SMSQueueID"
Dim strUser As String = UCase(InputBox("Your Login Name?", "Security"))
If Verify_user_Settings(PrivG roup, DomController, strUser) Then
If ds.HasChanges() Then
Dim da As SqlDataAdapter
Dim command_builder As SqlCommandBuilder
da = New SqlDataAdapter(SelectCmdSt ring, conn)
da.TableMappings.Add("Tabl e", "SMSQUEUE")
command_builder = New SqlCommandBuilder(da)
da.Update(ds)
MsgBox("Changes have been Committed")
End If
Else
MsgBox("Group Security Policies denies you changing data.")
End If
Any suggestions ?
I HATE ADO.NET !!!! Things I always found easy are sudenly hard to do...... GRRRRRRR!!!!!!!
I fill my datagrid using this code :
Private Sub LoadData()
'Construct data adapter
SelectCmdString = "select * from SMSQUEUE WHERE Acknowledged=0 order by SMSQueueID"
da = New SqlDataAdapter(SelectCmdSt
da.Fill(ds, "SMSQUEUE")
LabelID.DataBindings.Add("
LabelDate.DataBindings.Add
LabelDestination.DataBindi
LabelDescription.DataBindi
DataGrid1.SetDataBinding(d
Timer1.Interval = CInt(myInterval) * 1000
Timer1.Enabled = True
End Sub
This gives a Datagrid with 13 columns
I only want the 8th column to be editable(boolean, so just click on/off)
If the checkin this row has been changed, I need to update the 1st and 5th column with a timestamp and the user that performed the update.
I also need to be able to do this in batch.
Now, I am saving changes to other columns in batch like this :
SelectCmdString = "select * from SMSQUEUE WHERE Acknowledged=0 order by SMSQueueID"
Dim strUser As String = UCase(InputBox("Your Login Name?", "Security"))
If Verify_user_Settings(PrivG
If ds.HasChanges() Then
Dim da As SqlDataAdapter
Dim command_builder As SqlCommandBuilder
da = New SqlDataAdapter(SelectCmdSt
da.TableMappings.Add("Tabl
command_builder = New SqlCommandBuilder(da)
da.Update(ds)
MsgBox("Changes have been Committed")
End If
Else
MsgBox("Group Security Policies denies you changing data.")
End If
Any suggestions ?
I HATE ADO.NET !!!! Things I always found easy are sudenly hard to do...... GRRRRRRR!!!!!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER