473,396 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem Populating Repeater

Hi:
Can anyone tell me why my datagrid doesn't populate with query results. For
some reason, I get "System.Byte[]" when I run the following query:

Dim oConn As OdbcConnection = New OdbcConnection("DSN")
Dim oCmd As OdbcCommand = New OdbcCommand("SELECT TOP 1 * FROM Table1",
gridConn)
Dim dr As OdbcDataReader

oConn.Open()
dr = oCmd.ExecuteReader()

If dr.HasRows() Then
dr.Read()
Label1.Text = dr.GetString(0)
Label2.Text = dr.GetString(1)
dr.Close()

oCmd.CommandText = "SELECT * FROM Table2"
dr = oCmd.ExecuteReader()
dg1.DataSource = dr
dg1.DataBind()
End If
Nov 18 '05 #1
1 1285
Where does System.Byte[] appear? It looks like what you are doing is putting
the table into the grid, but you dont use the grid in this fashion. When
the rendering takes place, the control looks for defined properties, or
calls object.ToString(). In your case the latter is being called. Take a
look at DataTables and DataViews. If not, load each row into a class and
pass the class to the DataSource property. You will need to define the
properties for the items using the Properties of the DataGrid.

HTH

Nick.
"Roger" <Th******@Superhero.com> wrote in message
news:uC*************@TK2MSFTNGP11.phx.gbl...
Hi:
Can anyone tell me why my datagrid doesn't populate with query results. For some reason, I get "System.Byte[]" when I run the following query:

Dim oConn As OdbcConnection = New OdbcConnection("DSN")
Dim oCmd As OdbcCommand = New OdbcCommand("SELECT TOP 1 * FROM Table1",
gridConn)
Dim dr As OdbcDataReader

oConn.Open()
dr = oCmd.ExecuteReader()

If dr.HasRows() Then
dr.Read()
Label1.Text = dr.GetString(0)
Label2.Text = dr.GetString(1)
dr.Close()

oCmd.CommandText = "SELECT * FROM Table2"
dr = oCmd.ExecuteReader()
dg1.DataSource = dr
dg1.DataBind()
End If

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
2
by: Colin Nicholls | last post by:
Platform: ASP.NET 1.1 I have a repeater nested inside another repeater. My outer repeater is looping fine. I am manually binding the inner repeater to a DataReader obtained from another...
8
by: I am Sam | last post by:
Hi everyone, This problem is making me old. I don't want to get any older. I have a multi-nested repeater control as follows: <asp:Repeater ID="clubRep1" Runat="server">...
3
by: gg77 | last post by:
Hi, I don't have much knowledge of the table control. I am basically trying to use a table thats populated with data rows from a dataSet but currently things aren't working for me. below is...
4
by: Antonio Carpentieri | last post by:
Hi all, in my previous post I've wrong typed some tems.. this is the corrected post. in a aspx page I have a repeater like this: <asp:repeater id=repeaterResults runat="server"...
0
by: Andrew | last post by:
Hi, Is it possible to populate a repeater with an Object ? ie. other than using a dataset or datatable. I was thinking of : Service1 service1 = new Service1(); Repeater1.DataSource =...
3
by: Iain Buchanan | last post by:
Moving this code below from v1.1 to 2.0... am now getting this bug... After I bind a repeater I move the repeater inside the placeholder using controls.add(), but when I do this, all the...
0
by: uncensored | last post by:
Hello everyone, I'm fairly new at .Net and I have a repeater inside a repeater problem. I will attach my code to this message but basically what I am able to tell when I run my page it tells me...
2
by: dm3281 | last post by:
Hi all -- I have a strange issue. I have obtained a scripted database and compiled ASP.NET 2.0 application from a sister site that I'm trying to implement locally. I have successfully...
2
by: Hong | last post by:
Hi, I have been scratching my head over this problem for hours, the repeater control I am using would only render the controls specified in HeaderTemplate and FooterTemplate, but the repeater...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.