Results 1 to 4 of 4

Thread: [RESOLVED] How to populate a DataGridView on form load but after running Update query

  1. #1

    Thread Starter
    Lively Member capella07's Avatar
    Join Date
    Oct 2006
    Location
    At work
    Posts
    71

    Resolved [RESOLVED] How to populate a DataGridView on form load but after running Update query

    The title pretty much says it all.

    I have a form with a datagridview. When it loads, the datagridview is populated from a SQL database table.

    I created all of this (dataset, tableadapter, datagridview, etc.) via drag and drop (please don't lecture me on why I should have hand-coded it - wasn't my choice...).

    Now what I need to do is before the datagridview is actually populated I want to run an Update query on the SQL table so the user sees the table with the results of the Update query.

    I added an update query to the dataset designer (the .xsd file), but I can't figure out how to get that to run before the grid is populated. I tried putting the line Me.emailWithAttachmentsTableAdapter.UpdateBookingNumQuery() in the form load event, but that didn't work.

    Any ideas, anyone?
    f u cn rd ths, u cn gt a gd jb n cmptr prgmmng.

  2. #2

    Thread Starter
    Lively Member capella07's Avatar
    Join Date
    Oct 2006
    Location
    At work
    Posts
    71

    Re: How to populate a DataGridView on form load but after running Update query

    Wow, seems like I'm stumping everyone on this one!
    f u cn rd ths, u cn gt a gd jb n cmptr prgmmng.

  3. #3
    Frenzied Member
    Join Date
    Aug 2005
    Posts
    1,042

    Re: How to populate a DataGridView on form load but after running Update query

    capella07:

    Well, I'm not sure whether the problem is that you have us all "stumped" or that we are unable to figure out what you are trying to do.

    Your posting doesn't appear to make a lot of sense.

    First you say:
    When it loads, the datagridview is populated from a SQL database table.
    And then you say:
    before the datagridview is actually populated I want to run an Update query on the SQL table
    So, if you have already populated it when it loads, how do you think you can run an update query before it is populated?

    Also, just running an Update Query won't change the information displayed in your datagrid particularly if you are using a client side cursor. You are going to need to refresh your data with the resync method or something.

    I think the problem is that we are not understanding just what you are trying to do.

    Good Luck

  4. #4

    Thread Starter
    Lively Member capella07's Avatar
    Join Date
    Oct 2006
    Location
    At work
    Posts
    71

    Re: How to populate a DataGridView on form load but after running Update query

    By George, you're right, AIS4U! Pure gibberish

    I did figure out what I need to do, though, so it's really a moot point now.

    I'll certainly make sure I'm clearer next time, though.

    Thanks!
    f u cn rd ths, u cn gt a gd jb n cmptr prgmmng.

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