Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
465
how to change name of the table and keep all WinGrid settings
posted


I have a project with 30 WinGrids using table ABC from MS SQL database.
Our client wants to change the name of the table from ABC to ABCD ( decision has been made ). I have to admit that all columns are the same ( for table ABC and ABCD ).

My question is how to change easily and quick all references pointed at table ABC and related to the WinGrid.
We have made numbers of changes inside each WinGrid settings and we will need to re-do our work if we will make this change manually based on adding new WinGrids for new table ABCD.

Any suggestions ?

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    Assuming that the table name is the only thing that changed and that the structure of the data is the same, you might be able to save the layout of each grid to a file, then make the change, and then load the layout back into the grid.

    I think this will work for the root-level table in the grid, assuming it's just one table in a flat display and the table name is the only thing that changed. But you might want to just try it with one grid first to make sure the layout loads properly before you do all 30. The grid checks the name of the band when loading the layout to make sure it's a valid layout, so it's possible it might reject it if the band names are different, but I'm pretty sure it will work for a single table.

    If that doesn't work, it might be easiest for you to simple ignore the real name of the table and set the TableName on your DataTable to the old name after you get the data. Then nothing in your application will need to change except the SQL statements that get the data.  In fact, I think you could write your SQL to return the table with the old name using an alias and then you would not have to do anything.