|
-
Jan 23rd, 2003, 10:29 AM
#1
Thread Starter
Member
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.
-
Jan 23rd, 2003, 02:24 PM
#2
Sleep mode
What is the code you are running to load all data to the Grid ? Is your data in one table ?
try this :
VB Code:
' after initializing your Connection string and DataAdapter add this
MyAdapter.SelectCommand = New OleDbCommand("Select * from MyTable", MyConnection)
'Fill the DataSet with the Data
Try
MyAdapter.Fill(MyDataset)
Catch x As System.Exception
MsgBox(x.Message)
End Try
Me.DataGrid1.DataSource = MyDataset.Tables("MyTable")
-
Jan 23rd, 2003, 03:32 PM
#3
Thread Starter
Member
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?
-
Jan 24th, 2003, 03:50 AM
#4
Registered User
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.
-
Jan 24th, 2003, 04:24 AM
#5
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?
-
Jan 24th, 2003, 10:44 AM
#6
Thread Starter
Member
Thanks for the replies! I resolved the problem. It was a poorly excuted SQL stmt. Thanks again!
-
Jan 24th, 2003, 12:18 PM
#7
Sleep mode
Cool ! I had doubt there's something wrong with your SQL Statement.Because your DataAdapter only loads data based on SQL criteria.
-
Jan 24th, 2003, 12:54 PM
#8
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|