| | |
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 .net2008 2008 access account add advanced application array basic beginner browser button buttons click code combo cpu cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic employees excel exists fade filter forms generatetags html images input intel internet listview mobile module monitor mysql net number objects open panel pdf picturebox picturebox2 port position print printing printpreview problem regex reuse right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver storedprocedure survey temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet vista visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





