How to clear columns record for dataset search query??
Hello…
I’ve got MS Access (.mdb) database binding with a form , After doing database search query in vb.net form I want to set specific columns to null value by pressing a button and save these changes to the database table?
I Know the codes for clearing columns in the database table but I’m looking for clearing dataset columns!
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Del As New OleDb.OleDbCommand
Del.Connection = con
Del.CommandType = CommandType.Text
Del.CommandText = "UPDATE Table1 SET column4 = null , column5= null , column7= null , column21= null "
con.Open()
Del.ExecuteReader()
con.Close()
Refresh_Dataset2()
End Sub
Any idea PLZ :confused:
Regards…
Re: How to clear columns record for dataset search query??
well, for starters you should NEVER be using a reader to execute an action query like that. You should be using .ExecuteNonQuery ... that's what it is designed for.
as for clearing dataset columns... that could mean a couple things... what is it you are trying to do?
-tg
Re: How to clear columns record for dataset search query??
Quote:
Originally Posted by
techgnome
well, for starters you should NEVER be using a reader to execute an action query like that. You should be using .ExecuteNonQuery ... that's what it is designed for.
as for clearing dataset columns... that could mean a couple things... what is it you are trying to do?
-tg
Hi TG..
Thanks for the advice about using .ExecuteNonQuery
For the dataset clearing I’m trying to do the following scenario:
I’ve got DGV which showing the complete database as dataset1, after doing a search by command button ; the results will be shown in the same DGV as dataset2,now I want to clear a specific columns in the dataset2 by pressing a button…
Any idea...
Regards…