| | |
deleting the records of the MS access table using VB.NET
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Thread Solved
![]() |
•
•
Join Date: Oct 2008
Posts: 32
Reputation:
Solved Threads: 4
Dim con as new OledbConnection
con = new OledbConnection (constring)
con.open()
Dim cmd as new OledbCommand
cmd = new OledbCommand("Delete Query")
cmd.ExecuteNonQuery()
cmd.Dispose()
con.close()
con = new OledbConnection (constring)
con.open()
Dim cmd as new OledbCommand
cmd = new OledbCommand("Delete Query")
cmd.ExecuteNonQuery()
cmd.Dispose()
con.close()
•
•
Join Date: Nov 2008
Posts: 24
Reputation:
Solved Threads: 0
I tried this code and it is throwing an exception that connection property has not been initialized!!!
giving error in this statement
giving error in this statement
VB.NET Syntax (Toggle Plain Text)
cmd.ExecuteNonQuery()
•
•
Join Date: Oct 2008
Posts: 32
Reputation:
Solved Threads: 4
try this
Dim con as new OledbConnection
con = new OledbConnection (constring)
con.open()
Dim cmd as new OledbCommand
cmd = new OledbCommand("Delete Query",con)
cmd.ExecuteNonQuery()
cmd.Dispose()
con.close()
Dim con as new OledbConnection
con = new OledbConnection (constring)
con.open()
Dim cmd as new OledbCommand
cmd = new OledbCommand("Delete Query",con)
cmd.ExecuteNonQuery()
cmd.Dispose()
con.close()
•
•
Join Date: Nov 2008
Posts: 24
Reputation:
Solved Threads: 0
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Try
oCmdOleDb = New OleDbCommand("Delete from table1")
oConnOleDb = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\database1.mdb")
oConnOleDb.Open()
If (oCmdOleDb.ExecuteNonQuery > 0) Then
StatusStrip1.Items(0).Text = ("records deleted from the table")
End If
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Information)
Finally
oConnOleDb.Close()
End Try
End Sub
[/code]
Try
oCmdOleDb = New OleDbCommand("Delete from table1")
oConnOleDb = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\database1.mdb")
oConnOleDb.Open()
If (oCmdOleDb.ExecuteNonQuery > 0) Then
StatusStrip1.Items(0).Text = ("records deleted from the table")
End If
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Information)
Finally
oConnOleDb.Close()
End Try
End Sub
[/code]
•
•
Join Date: Oct 2008
Posts: 32
Reputation:
Solved Threads: 4
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Try
oConnOleDb = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\database1.mdb")
oConnOleDb.Open()
oCmdOleDb = New OleDbCommand("Delete from table1",oConnOleDb)
If (oCmdOleDb.ExecuteNonQuery > 0) Then
StatusStrip1.Items(0).Text = ("records deleted from the table")
End If
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Information)
Finally
oConnOleDb.Close()
End Try
End Sub
Try
oConnOleDb = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\database1.mdb")
oConnOleDb.Open()
oCmdOleDb = New OleDbCommand("Delete from table1",oConnOleDb)
If (oCmdOleDb.ExecuteNonQuery > 0) Then
StatusStrip1.Items(0).Text = ("records deleted from the table")
End If
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Information)
Finally
oConnOleDb.Close()
End Try
End Sub
![]() |
Similar Threads
- Inserting,deleting,updating and editing records to a MS Access database (C#)
- URGENT!! Adding, updating and deleting records in VB.Net 2003. URGENT!! (VB.NET)
Other Threads in the VB.NET Forum
- Previous Thread: Help with Visual Studio 2008
- Next Thread: can someone help me with saving my data in a file program?
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access account arithmetic array assignment basic box button buttons center check code component connectionstring convert crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel fade file-dialog firewall folder ftp generatetags hardcopy image images input insert intel isnumericfuntioncall math monitor navigate net networking opacity output passingparameters peertopeervideostreaming picturebox picturebox1 port problem problemwithinstallation project record reports" savedialog searchvb.net select serial shutdown string survey tcp temp temperature text textbox timer toolbox trim updown user useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





