Re: How to refresh a datatable??




Hello Bill!
Thank you so much for your help and enthusiasm.
I think that all you said is very correct in the case the DataTable points
to a real Table. But in my case, the DataTable, in fact, is a VIEW (so as I
understand, It's a RUNTIME QUERY or VIRTUAL Table), it means that I can not
Insert/Delete/Modify any data in the VIEW directly, instead of it, i can
only Insert/Delete/Modify the data in the table IncomeProducts. In order to
display all the updated data in the DataGrid (DataGrid is used to display
the VIEW), I must execute the Query again (refresh VIEW again--->load all
data again), right???
Regards!




"W.G. Ryan eMVP" <WilliamRyan@xxxxxxxxx> wrote in message
news:#oovJ6AUFHA.3840@xxxxxxxxxxxxxxxxxxxxxxx
> > 1. Want to ask you If I do correctly????
> From the looks of everything, it looks ok
>
> > 2. Now Everytime when i want to add a new 'row' to the table
> IncomeProducts,
>
> From the looks of how this is set up, you have two options. One is that
you
> can store the Datatable in session or viewstate, and each times someone
> makes an addition, add a datarow to the datatable with the new
information.
> When they are done with all of their editing, you can pass the datatable
to
> an adapter configured to handle the update. Or, each time you can call
> update. In most cases you'll probably want to opt for the latter.
Assuming
> that your update is successful, the database and the local datatable
should
> look the same with the exception of new rows added/deleted/modified by
other
> users. If this isn't a problem, then you don't need to requery the
database
> b/c the datatable and the database will match as soon as you fire the
> update. If you absolutely needed to have the data match and knew that you
> didn't want to overwrite any data that was changed by someone else, the
> safest way to do it is check for new data with a new select and
repopulate.
> There are a few ways to go about this but this is what you are trying to
> avoid right?
>
> Anway, by just submitting your updates your table and db will match as
long
> as no exceptions are raised so I think you're good to go.
>
> If I misunderstood what you were asking though or didn't answer your
> question to your satisfaction, please let me know.
>
> Cheers,
>
> Bill
>
> --
> W.G. Ryan, MVP
>
> www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
> "Alex" <chipheo2k@xxxxxxx> wrote in message
> news:eeSt7LAUFHA.612@xxxxxxxxxxxxxxxxxxxxxxx
> > Hello!
> > I have a small prob, so pls help me to solve it.
> > I have 2 tables
> > Products(ProductID, ProductName, Price)
> > Stores(StoreID, StoreName)
> > now I must design a table for Income-Product: IncomeProducts(id, Date ,
> > ProductID, Quantity, Price, Total, StoreID).
> > But I want to display the table IncomeProducts in the DataGrid like that
:
> > | ProductName | Price | Quantity | Total | StoreName
> > To do it: I use VIEW to make a visual Table (IncomeProductView):
> > SELECT dbo.IncomeProducts.[Date],
> > dbo.Products.ProductName,dbo.IncomeProducts.Price,
> > dbo.IncomeProducts.Quantity,
> dbo.IncomeProducts.Total,
> > dbo.Stores.StoreName
> > FROM dbo.IncomeProducts INNER JOIN
> > dbo.Products ON dbo.IncomeProducts.ProductID =
> > dbo.Products.ProductID INNER JOIN
> > dbo.Stores ON dbo.IncomeProducts.StoreID =
> > dbo.Stores.StoreID
> >
> >
> >
> >
> > And now I display this View on the DataGrid
> > ...
> > SqlDataAdapter sda..
> > DataSet ds
> > sda.Fill(ds, "IncomeProductView");
> > DataGrid dg;
> > dg.DataSource = ds.Tables["IncomeProductView"];
> > ....
> >
> > 1. Want to ask you If I do correctly????
>
> > I want it to be displayed in the DataGrid ( to do that, the View must
> > refresh to get the new inserted row). How can I do it???? or I must
Clear
> > the ds and "Download" again??? It's very bad......
> >
> >
> > Thanks
> >
> >
>
>


.



Relevant Pages

  • Re: How to refresh a datatable??
    ... then you don't need to requery the database ... > But I want to display the table IncomeProducts in the DataGrid like that: ... > And now I display this View on the DataGrid ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: best way to tackle issue with writing Data, Appending Data and Rea
    ... data that I have read from my database and the two are related. ... would help me in my display of data in a grid. ... Read user input and store user input and DataRow to a file. ... display user input and data row in a DataGrid. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: FMPro8 - Logging out of an IWP database
    ... > Bill Marriott wrote: ... >> otherwise provide a mechanism for them to return to the database. ... My logout script commits the new record okay, ... >>>display it. ...
    (comp.databases.filemaker)
  • Re: How to avoid users pick same case
    ... The case number will be removed from the datagrid. ... I am using ADO and Access database which is located on the ... In a 'general' table I have a field named InUse. ... I display a message and skip. ...
    (microsoft.public.vb.general.discussion)
  • Re: Found Serious Bug!
    ... Bill ... > datagrid doing something to the dataview and then to the datatable which I ... >> The DataView doesn't give a hoot about the DB once you've created it. ... some other code in the program or a corrupt database file. ...
    (microsoft.public.dotnet.framework.adonet)