|
-
Apr 28th, 2005, 05:13 PM
#1
Thread Starter
Member
Datagrid Question
One quick question... datagrids.
I have my output looking the way I want and it now prints to the datagrid fine but my datagrid isn't listing first entry, starts with the second. It's like the first row isn't being read but the rest print fine. Did I forget something?
Thanks a ton,
M
-
Apr 30th, 2005, 01:43 PM
#2
Re: Datagrid Question
Show us the datagrid's code and the codebehind for your datagrid's binding.
-
May 4th, 2005, 11:42 AM
#3
Thread Starter
Member
Re: Datagrid Question
Here's what I had...
sqlcon.Open()
Dim drManagers As SqlDataReader = cmdGetManagers.ExecuteReader
While drManagers.Read
dgrid_ViewAllUsers.DataSource = drManagers
dgrid_ViewAllUsers.DataBind()
End While
drManagers.Close()
sqlcon.Close()
sqlcon is my connection string and cmdGetManagers is my SQL Command. I'm trying to figure out why the first line in my datagrid is left out. The datagrid looks fine just that first row is showing up. The first row in my datagrid is actually the second row in my table. Any help would be much appreciated.
Thanks,
M
-
May 5th, 2005, 05:19 AM
#4
Frenzied Member
Re: Datagrid Question
You don't need to do a while drManagers.Read the databinding will handle that.
Try:
Code:
sqlcon.Open()
Dim drManagers As SqlDataReader = cmdGetManagers.ExecuteReader
dgrid_ViewAllUsers.DataSource = drManagers
dgrid_ViewAllUsers.DataBind()
drManagers.Close()
sqlcon.Close()
Calling drManagers.Read actually moves to the next record in the DataReader hence the missing first record.
HTH
DJ
If I have been helpful please rate my post. If I haven't tell me!
-
May 5th, 2005, 01:39 PM
#5
Thread Starter
Member
Re: Datagrid Question
Thanks for the feedback...
That was the problem that was screwing me up. Haven't been programming for a few years and holy cow am I rusty. Thanks again for the help.
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
|