| | |
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 |
Tag cloud for VB.NET
.net 30minutes 2005 2008 access account application arithmetic array arrays basic binary bing button buttons c# center check checkbox code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dropdownlist excel file-dialog folder ftp generatetags google gridview hardcopy image images inline insert intel internet listview mobile monitor ms net networking output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project reports" save searchbox searchvb.net select serial server soap sorting table tcp 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 wpf





