Page 1 of 1

Manually Bind to List View or Grid View

Posted: Tue 30 Nov 2010 15:14
by tegansnyder
I need the ability to manually bind a OracleDataReader output to a list view or a grid view.

What is the best way to accomplish this?

Code: Select all

Dim OracleConnection As OracleConnection = New OracleConnection()
OracleConnection.ConnectionString = "User Id=jdoe;Password=password;Server=ordb;"
OracleConnection.Open()

Dim command As OracleCommand = OracleConnection.CreateCommand()
command.CommandText = "SELECT * from users WHERE user = '" & Request.Form("user") &"'"

dim reader As OracleDataReader = command.ExecuteReader()
Do I somehow need to cast the OracleDataReader as a DataTable and bind that to a Grid View/List View?

Thanks

Posted: Thu 02 Dec 2010 14:43
by Shalex
We recommend you using the OracleDataSource component for web applications development (this component is available in the Professional and Developer editions). This control allows design time development. E.g.: open Form Designer in your web application, drag&drop from Toolbox OracleDataSource (the Oracle Data tab) and GridView (the Data tab), assign connection to OracleDataSource and configure this data source in design time, then assign OracleDataSource to the GridView.DataSourceID property - the GridView.Columns collection will be generated automatically.

If you want to create your GridView manually in the code using OracleDataReader, please refer to the documentation:
http://msdn.microsoft.com/en-us/library ... dview.aspx
http://www.devart.com/dotconnect/oracle ... eader.html