473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

get dataset row count

Sam
Hi,
I've got a datagrid and a dataset used as the datasource.
I'd like to do a test, if the index of the selected row in the grid is
greater than the dataset.tables(0).rows.count. The problem is that if I
edit the last row of the grid, a new row will be added below and to the
dataset. Therefore the number of rows in the dataset won't be equal to
the number of records in the database. How can I get the number of rows
in the dataset originally ?

Thx

Nov 21 '05 #1
3 10321
Try this code:

Me.BindingContext(Me.Search2.DataGrid1.DataSource) .Count

Nov 21 '05 #2
Sam,

Strange.
The datagrid reflects the rows in your datasource.

There is one time that you can say it is not. And that is while the user is
editing because he/she by instance has added a new row. The data in a
datagrid is not updated in the datasource, as long as the cursor is on the
same datagrid row.

However for that is the instruction Endcurrentedit by instance like this.
\\\\
BindingContext(ds.Tables(0)).EndCurrentEdit()
////

I hope this helps,

Cor
Nov 21 '05 #3
So I cut and paste the code from my program. The correct one code
should be

Me.BindingContext(D*ataGrid1.DataSource).Count

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Boffo Jinko | last post by:
This should be obvious, but I can't figure it out... I have the following web service: <WebMethod (Description:="Returns a dataset of all people from the database.")> _ Public Function...
3
by: martin | last post by:
Hi, I am having trouble determining if my dataset is empty. I have function that populates a dataset from a database and then retuens it. If the database contains no data then the dataset will...
15
by: JIM.H. | last post by:
Hello, Can I send a dataset as a parameter into stored procedure and import data to a table in the stored procedure? Thanks, Jim.
2
by: Stanav | last post by:
Hello all, I'm developing a web application using VB.Net 2003 and Framework 1.1. This application queries an AS/400 database. I'm using the IBM OleDb provider that came with IBM Client Access for...
1
by: scottin | last post by:
I setup the dataset, which is the datasource for a datagrid. When I originally fill the dataset, the data is loaded into dataset.tables(0). (dataset.tables(0).rows.count = 8) Then, if a row...
10
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I...
2
by: jdzemke | last post by:
I am trying to validate that a null value is not chosen from a dynamic dataset called "OBDataSet__135_1" when a form Submit operation is performed. To do this I have a javascript function called...
7
by: samoore | last post by:
I have found two or three places where it states that to update an item in a dataset, all I have to do is do DataSet.Tables.Rows.ItemArray = "String". When I attempt to do this it does not work. ...
0
by: buk110 | last post by:
Hi guys, I'm really hoping that someone can help me... I have 3 datasets. One that will contain the initial information when I open up the database; one that will pull in information afterwards;...
0
by: Jordi Maicas | last post by:
Hi!! I'm doing a form to make a login, so, user and pass.... and so on. The problem is that first of all, I check how many records are in the table, and later I would like to make a do/while....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.