Datagrid Rows Count
-
Hi, I'm creating a windows application for user to input inventory items. I'm using a datagrid for the user input. However, when I'm creating the SQL statement to insert it into the database, I couldn't figure out how to get the datagrid row count. When i'm using datagrid.VisibleRowCount, only the visible items will be counted (therefore added to the DB). How could I get the total row count for datagrid. Anybody? Thanks! :)
-
Hi, I'm creating a windows application for user to input inventory items. I'm using a datagrid for the user input. However, when I'm creating the SQL statement to insert it into the database, I couldn't figure out how to get the datagrid row count. When i'm using datagrid.VisibleRowCount, only the visible items will be counted (therefore added to the DB). How could I get the total row count for datagrid. Anybody? Thanks! :)
hello, why do you need the rowcount? if your datagrid is bound to dataset you just have to call the update-methode of the dataadapter. the dataadapter have to be configured with a selectstatement and the db-table must have a primary key so the dataadapter can generate the insert, update and delete statements. or isn't this your problem..? keep trying
-
hello, why do you need the rowcount? if your datagrid is bound to dataset you just have to call the update-methode of the dataadapter. the dataadapter have to be configured with a selectstatement and the db-table must have a primary key so the dataadapter can generate the insert, update and delete statements. or isn't this your problem..? keep trying
Actually my datagrid is not bound to any dataset. I start the form with an empty datagrid, which let the user to input the data (it look somewhat like microsoft access). So once the user has fill in all the data, the user has to click a button to save the records. To save the records, i need to know how many rows of data the user has entered. Therefore I need to know the number of rows for that datagrid. And the only method that the datagrid has is "VisibleRowCount", which only count the visible rows.
-
Actually my datagrid is not bound to any dataset. I start the form with an empty datagrid, which let the user to input the data (it look somewhat like microsoft access). So once the user has fill in all the data, the user has to click a button to save the records. To save the records, i need to know how many rows of data the user has entered. Therefore I need to know the number of rows for that datagrid. And the only method that the datagrid has is "VisibleRowCount", which only count the visible rows.
it is much easier to handle data with a dataset. you can build the strucure of the dataset in memory and bind it to the grid. i think the grid is not a good container for data, it's just a input/output mask for something like a grid.