| | |
DataGrid with ado.net.
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2005
Posts: 14
Reputation:
Solved Threads: 0
:rolleyes: I have the following with an ado.net routine called.
Public Sub DoModify()
Dim bm As BindingManagerBase = Me.DataGrid1.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember)
Dim dr As DataRow = CType(bm.Current, DataRowView).Row
Dim editform As New EditTransOverride(dr)
oldPolicyNumber = dr.Item(1)
oldTransCode = dr.Item(2)
oldTransEffDate = dr.Item(3)
Dim retval As DialogResult = editform.ShowDialog()
If retval = DialogResult.OK Then
bm.EndCurrentEdit()
Try
Dim substr As String = dr.Item(4)
If substr Is System.DBNull.Value Then
substr = ""
End If
If Not substr = "" Then
substr = substr.Substring(0, 2)
End If
ExecOnTransOverride.upd(dr.Item(1), dr.Item(2), dr.Item(3), substr, dr.Item(5), dr.Item(6), dr.Item(8), dr.Item(7), DateTime.Now, dr.Item(7), dr.Item(9), oldPolicyNumber, oldTransCode, oldTransEffDate)
SqlDataAdapter1.Update(ds, "DsTransOverride1")
ds.Tables("DsTransOverride1").AcceptChanges()
MsgBox("Data Inserted Successfully !", MsgBoxStyle.Information, Me.Text)
Catch se As SqlException
MessageBox.Show(se.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Else
bm.CancelCurrentEdit()
End If
End Sub
Now I would like to update the datagrid with the use of the
SqlDataAdapter1.Update(ds, "DsTransOverride1")
ds.Tables("DsTransOverride1").AcceptChanges()
and use my ado.net routine since I tested it and it works and updates the database.
The only thing I need to do in the above routine is to update the datagrid. How do I go about doing this?
Public Sub DoModify()
Dim bm As BindingManagerBase = Me.DataGrid1.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember)
Dim dr As DataRow = CType(bm.Current, DataRowView).Row
Dim editform As New EditTransOverride(dr)
oldPolicyNumber = dr.Item(1)
oldTransCode = dr.Item(2)
oldTransEffDate = dr.Item(3)
Dim retval As DialogResult = editform.ShowDialog()
If retval = DialogResult.OK Then
bm.EndCurrentEdit()
Try
Dim substr As String = dr.Item(4)
If substr Is System.DBNull.Value Then
substr = ""
End If
If Not substr = "" Then
substr = substr.Substring(0, 2)
End If
ExecOnTransOverride.upd(dr.Item(1), dr.Item(2), dr.Item(3), substr, dr.Item(5), dr.Item(6), dr.Item(8), dr.Item(7), DateTime.Now, dr.Item(7), dr.Item(9), oldPolicyNumber, oldTransCode, oldTransEffDate)
SqlDataAdapter1.Update(ds, "DsTransOverride1")
ds.Tables("DsTransOverride1").AcceptChanges()
MsgBox("Data Inserted Successfully !", MsgBoxStyle.Information, Me.Text)
Catch se As SqlException
MessageBox.Show(se.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Else
bm.CancelCurrentEdit()
End If
End Sub
Now I would like to update the datagrid with the use of the
SqlDataAdapter1.Update(ds, "DsTransOverride1")
ds.Tables("DsTransOverride1").AcceptChanges()
and use my ado.net routine since I tested it and it works and updates the database.
The only thing I need to do in the above routine is to update the datagrid. How do I go about doing this?
![]() |
Similar Threads
- link access table in ADO.NET (VB.NET)
- How good is ADO.NET vNext CTP now? (C#)
- Saving Excel Spreadsheet using ADO.net gives inconsistent results (C#)
- Long ado net question but urgent help required (ASP.NET)
- ADO.NET question modification. (VB.NET)
- ADO.Net SQL UPDATE using OleDBAdapter (C#)
- Can i do something international using which side of vb.net whether it is ado.net, we (VB.NET)
- Data Navigation in textboxes with ADO.NET (like ADO) (ASP.NET)
Other Threads in the VB.NET Forum
- Previous Thread: ADO.NET question modification.
- Next Thread: anyone can help me, plzzz???
| Thread Tools | Search this Thread |
.net .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dissertationthesis dropdownlist excel fade file-dialog folder ftp generatetags google hardcopy image images input insert intel internet mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print problem problemwithinstallation project reports" save savedialog searchbox searchvb.net select serial shutdown soap string survey table tcp temperature text textbox timer toolbox trim update updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





