Results 1 to 3 of 3

Thread: [RESOLVED] Reset DataSet?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Resolved [RESOLVED] Reset DataSet?

    How do I reset a DataSet?

    I have a form that is bound to a DataSet. When the user is done entering their information and they save the form's data, I call a ResetForm routine in my code. I can clear the DataSet with DataSet.Clear(), but that doesn't reset the Identity column's next value. Instead of giving me a 1 for a new record, it gives me the next number that would have been available after the preceeding record saved. (For example, if the record was saved and the identity value returned from the database was 300, then selecting to create a new transaction on my form gives me 301 in this field.)

    The only problem is that I am showing this value to the end user. They know that a 1 means that they are going to get a new record. I don't want it to confuse them and make them think they may be editing an already existing record from the database.

    I tried to set my DS = Nothing and then set it back to what it was supposed to be, but that seemed to cause some issues with my bindings.

    Any assistance would be greatly appreciated!
    My.Settings.Signature = String.Empty

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Reset DataSet?

    How about
    VB Code:
    1. DataSet=DataSet.Clone

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Re: Reset DataSet?

    I just removed the Identity column from being visible on the form and used another textbox for this field.

    Not ideal, but it gets the job done.
    My.Settings.Signature = String.Empty

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