| | |
Delete a row in a datagrid and the underlying database vb net 2003
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2008
Posts: 3
Reputation:
Solved Threads: 0
Greetings.
I've hunted around quite a bit on this one. There seem to be as many potential solutions as there are folks who have asked the question. I'm rewriting a vb6 app in .net and rather than use the conversion process i felt that the app could do with a complete redesign
I have an access database being displayed by a datagrid in vb.net 2003. Works fine I can search and sort and edit and add but i can't delete.
.
I can update rows in the datagrid and update the database with
I can add new rows and get them added in the database but as for deleting i'm stuck.
I would appreciate help to get a simple way to add delete functionality.
Thanks
I've hunted around quite a bit on this one. There seem to be as many potential solutions as there are folks who have asked the question. I'm rewriting a vb6 app in .net and rather than use the conversion process i felt that the app could do with a complete redesign
I have an access database being displayed by a datagrid in vb.net 2003. Works fine I can search and sort and edit and add but i can't delete.
VB.NET Syntax (Toggle Plain Text)
Dim mySurname As String mySurname = txt_SearchSurname.Text & "%" OleDbDataAdapter1.SelectCommand.Parameters("SURNAME").Value = mySurname DataSet21.Clear() OleDbDataAdapter1.Fill(DataSet21)
I can update rows in the datagrid and update the database with
VB.NET Syntax (Toggle Plain Text)
OleDbDataAdapter1.Update(DataSet21)
I can add new rows and get them added in the database but as for deleting i'm stuck.
I would appreciate help to get a simple way to add delete functionality.
Thanks
•
•
Join Date: Aug 2008
Posts: 3
Reputation:
Solved Threads: 0
Greetings.
I have managed to get it working. I'm indebted to arjunsasidharan who posted some help to another member.
Not sure if it is the "correct" way or if there is a better way but it seems to work.
Is there a better way of refreshing the datagrid after the row has been deleted in the underlying database.
I've just cleared the datagrid and reloaded it
I have managed to get it working. I'm indebted to arjunsasidharan who posted some help to another member.
Not sure if it is the "correct" way or if there is a better way but it seems to work.
Is there a better way of refreshing the datagrid after the row has been deleted in the underlying database.
I've just cleared the datagrid and reloaded it
VB.NET Syntax (Toggle Plain Text)
DBConn = New OleDb.OleDbConnection("Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _ "ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""C:\Program Files\Skimail" & _ "\NZSKIMAIL.mdb"";Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transact" & _ "ions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:S" & _ "FP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Passwo" & _ "rd=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compac" & _ "t=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:E" & _ "ncrypt Database=False") ln_CurrentTrakID = DataGrid1.Item(ln_CurrentRowNumber, 43) DBDelete.CommandText = "Delete From NZDATA Where TRAKIDreal = " & Trim(Str(ln_CurrentTrakID)) DBDelete.Connection = DBConn DBDelete.Connection.Open() DBDelete.ExecuteNonQuery() DBConn.Close() DataSet21.Clear() OleDbDataAdapter1.Fill(DataSet21)
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: user control missing
- Next Thread: Need to create a site that integrates with a Map program
Views: 1722 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access advanced application array basic beginner browser button buttons center checkbox class client code combo convert cuesent data database datagrid datagridview date datetimepicker design designer dissertation dissertations dissertationtopic eclipse excel fade filter forms generatetags html images input intel internet lib listview map mobile monitor net number objects open panel pdf picturebox picturebox2 port position print printing problem read remove richtextbox save searchvb.net select serial settings shutdown socket sorting sqlserver studio survey temperature textbox timer timespan transparency txttoxmlconverter user usercontol validation vb vb.net vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms winsock wpf wrapingcode year





