Re: How to refresh a datatable??



> 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??
    ... Hello Bill! ... display all the updated data in the DataGrid (DataGrid is used to display ... > that your update is successful, the database and the local datatable ...
    (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: 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: User input directly into datagrid or table?
    ... My database table will not be in the ... same format as the datagrid that I wish to display to the user. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Drop Down List for SQL Database
    ... list using the BindingContext. ... //Get the data from the database ... > This is the code im using to display in datagrid: ... > Can someone Please shwo me how to display this column in a DropDownList??? ...
    (microsoft.public.dotnet.languages.csharp)