Results 1 to 3 of 3

Thread: How to clear columns record for dataset search query??

  1. #1

    Thread Starter
    Lively Member HOTFIX's Avatar
    Join Date
    Sep 2008
    Posts
    91

    Question 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

    Regards…

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Lively Member HOTFIX's Avatar
    Join Date
    Sep 2008
    Posts
    91

    Re: How to clear columns record for dataset search query??

    Quote Originally Posted by techgnome View Post
    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…

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width