|
-
May 4th, 2005, 11:42 AM
#1
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
#2
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
#3
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
|