| | |
deleting the records of the MS access table using VB.NET
Please support our VB.NET advertiser: Intel Parallel Studio Home
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 |
.net 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 gridview hardcopy image images input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap survey table tcp temperature text textbox timer toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





