|
-
Sep 16th, 2002, 10:15 AM
#1
Thread Starter
Member
How many items are there in my dataset??
Number of items???
I use the following code to retreive records from an ACCESS database and everything works fine. How do I find out how many items there are in the dataset or the dataadapter??
________________________________________________
strsql = "select * from spis where titel like '%" & TextBox1.Text & "'"
objda = New OleDb.OleDbDataAdapter(strsql, objconn)
ds.Clear()
DataGrid1.DataSource = ds
objda.Fill(ds)
DataGrid1.DataBind()
----------------------------------------------------------------------
-
Sep 16th, 2002, 10:31 AM
#2
Junior Member
I think this should work
John
Ds.Clear()
OleDbDataAdapter1.Fill(Ds, "table")
Dim iCnt As Integer
iCnt = Ds.Tables("table").Rows.Count
-
Sep 16th, 2002, 01:12 PM
#3
Thread Starter
Member
sorry, it didn't work
No, that was not a good idea, I'm afraid. Thanks anyway.
My problem is that I execute a SQL-query and that makes the number of records different each time. So, looking at the number of records in the table is not the solution here. I would like to have the number of records in the dataset or in the datagrid for displaying the number of search hits to the user.
/Anders
-
Sep 16th, 2002, 03:25 PM
#4
Hyperactive Member
what tattenhoe said will work for what you want. The dataset will hold the information that you got using the SQL Statement. The table name will be the name you gave the resultset that the dataset is holding. or something like that.
-
Sep 17th, 2002, 01:51 AM
#5
Thread Starter
Member
Yes! It works!
I didn't understand all of it at first!
Thank you for your help.
/Anders
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|