Skip to content

Adding records in Data Grid View

Mervha Nifflemhell

Asked Mar 25, 2008, 1:46 AM EDT1 answer
Share
LinkedInX

what codes will be used in adding records (btn_Add)  from

1. txtProduct   2. txtQuantity   3. txtPrice

to the Data Grid View without saving it on the database.

meaning, you can able to view what have you added once, but haven't saved it yet.

I established a table in the sql with the ff. field names:

1. ProductName   nvarchar(50)   2. Quantity  nvarchar(50)  3. Price    nvarchar(50)

you could have the access to get the contents from the data grid view.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    0
     I didnt understand your question very well but, If you want display a data in your datagridview and at the same time have not the data saved back in your database
    1.  create a dataset then a  datatable  within  it
    2.  Fill the datatable from the database with dataAdapter
    3.  set the datasource to your dataset an datamemeber to datatable.tablename
    4. Don't use The update method of the dataAdapter to save data back in the data base
    with this manner you have two diffrement views  one  in the datagrid  and the  other in the database
     
    0