Results 1 to 8 of 8

Thread: How many records can a datagrid display[RESOLVED]

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    54

    Question How many records can a datagrid display[RESOLVED]

    I have an Access DB (backend) with 200 records in it. Then I have a form w/ a datagrid that loads the dataset when the form loads. The problem is that only 100 or so records are filled into the datagrid. I have a label assigned to a record count, it shows the correct number or records in the DB. Why aren't all the records being loaded into the datagrid? Someone please advise........
    Last edited by Nintendo_Wizard; Jan 24th, 2003 at 10:45 AM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    What is the code you are running to load all data to the Grid ? Is your data in one table ?
    try this :

    VB Code:
    1. ' after initializing your Connection string and DataAdapter add this  
    2.  
    3. MyAdapter.SelectCommand = New OleDbCommand("Select * from MyTable", MyConnection)
    4. 'Fill the DataSet with the Data
    5. Try
    6. MyAdapter.Fill(MyDataset)
    7. Catch x As System.Exception
    8. MsgBox(x.Message)
    9.  End Try
    10. Me.DataGrid1.DataSource = MyDataset.Tables("MyTable")

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    54
    Hey pirate! Thanks for your reply. Your code looks similar to what I have already tried. Except, I binded the datasource (Table) to the datagrid at design time (instead of in code). And to estabilsh the connection I used the config. wizard of the Oledbdataadapter. I made the mistake of deleting the .idb file (microsoft developer intermediate file). I thought that it would be re-created each time the connection was established. Could this be the problem?

    Here's the details:
    I just read on MSDN that there really arn't any limits on the number of rows a datagrid can display. I am not using any filtering in the SELECT stmt. In fact I am using all the columns in a datatable. Its pretty weird. I open my database and all the records are there, but all of them aren't being displayed in the datagrid. Here's how I have it set up:

    Datagrid --> binded to a datasource (Ds.mytable)
    Then I use the form's load event to fill the datagrid.

    Another weird note: I have enabled an UPDATE button on the form (w/ the datagird). I scroll down to the first empty row (ID 200 or so). I then enter information, hit update. After I check my Db the new record is there! But when I open the form w/ the datagrid it isn't!! What's going on?

  4. #4
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    Personal remark:

    There shouldn't be any limits of how many records to show in a datagrid. I had to leave the thought of binding controls at designtime a couple of months ago though. I gave it a week or so, but databinding through designtime just doesn't work the way you would want it at least. I'm pretty sure there are a BUG or two with it as I've followed every MS recommendation there is. A lot of my problems with databinding went away as I started binding thing through code instead.

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Is this in VB.NET or ASP.NET? Also shouldn't there be a scrollbar on the side to scroll to the rest of the records?

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    54
    Thanks for the replies! I resolved the problem. It was a poorly excuted SQL stmt. Thanks again!

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Cool ! I had doubt there's something wrong with your SQL Statement.Because your DataAdapter only loads data based on SQL criteria.

  8. #8

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    54
    Well lets just say the programming and alcohol don't go good together. When I added a new column I changed the CommantText of the SELECT stmt for the Dataadapter, instead of using the config. wizard! I forgot to change the Stmt for UPDATE, INSERT, & DELETE. Learned my lesson!

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