Manually Bind to List View or Grid View

Manually Bind to List View or Grid View

Postby tegansnyder » Tue 30 Nov 2010 15:14

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
tegansnyder
 
Posts: 3
Joined: Tue 30 Nov 2010 14:55

Postby Shalex » Thu 02 Dec 2010 14:43

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
Shalex
Devart Team
 
Posts: 7781
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle