Results 1 to 5 of 5

Thread: How many items are there in my dataset??

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Linkoping, Sweden
    Posts
    50

    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()

    ----------------------------------------------------------------------

  2. #2
    Junior Member
    Join Date
    Sep 2002
    Location
    Milton Keynes UK
    Posts
    27
    I think this should work

    John


    Ds.Clear()
    OleDbDataAdapter1.Fill(Ds, "table")

    Dim iCnt As Integer

    iCnt = Ds.Tables("table").Rows.Count

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Linkoping, Sweden
    Posts
    50

    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

  4. #4
    Hyperactive Member
    Join Date
    May 2001
    Posts
    306
    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.

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Linkoping, Sweden
    Posts
    50

    Thumbs up 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
  •  



Click Here to Expand Forum to Full Width