473,669 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filling a datagrid from Oracle

I have a datagrid that has to be filled in a WinForms application. The
data comes from an Oracle database.

The normal procedure would be filling a dataset, but I have the problem
that there are over 100.000 records in the tables, so this has very low
performance when executing.

I then tried using an OracleDataReade r, but for some reason, I cannot
bind my reader to the datagrid, I get the following error:
"Complex DataBinding accepts as a data source either an IList or an
IListSource"

I use the following code for this reader:
Public Shared Function ReadAllExisting Reader() As
OracleClient.Or acleDataReader
Dim sqlCommand As String = "SELECT * FROM THTEST"

' DataSet that will hold the returned results

Dim pReader As OracleClient.Or acleDataReader
Dim db As Database = DatabaseFactory .CreateDatabase ()
Dim pOraConnection As OracleClient.Or acleConnection
pOraConnection = CType(db.GetCon nection(),
OracleClient.Or acleConnection)
Dim comm As OracleClient.Or acleCommand = New
OracleClient.Or acleCommand(sql Command, pOraConnection)

Try
pOraConnection. Open()
pReader =
comm.ExecuteRea der(CommandBeha vior.CloseConne ction)

Catch ex As Exception

Throw New Exception(ex.Me ssage)
Finally

End Try

Return pReader
End Function

And this is bound this way:
Dim reader As System.Data.Ora cleClient.Oracl eDataReader =
DAL.THTest.Read AllExistingRead er

..........
With Me.grdTHTest
.RowHeadersVisi ble = False
.DataSource = reader
.CaptionText = "TH Test"
.ReadOnly = True
End With

Anyone has a solution?

Jan 18 '06 #1
4 10574
You don't want to use a data reader. Rather, you want to take your
command that performs the select and set it as the SelectCommand on the
OracleDataAdapt er class. Then, you can call the Fill method, passing a
DataSet which is filled with the result set.

You can then bind that result set to your data grid.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"gillcleeren@go ogle mail DOT com" <gi*********@gm ail.com> wrote in message
news:11******** ************@o1 3g2000cwo.googl egroups.com...
I have a datagrid that has to be filled in a WinForms application. The
data comes from an Oracle database.

The normal procedure would be filling a dataset, but I have the problem
that there are over 100.000 records in the tables, so this has very low
performance when executing.

I then tried using an OracleDataReade r, but for some reason, I cannot
bind my reader to the datagrid, I get the following error:
"Complex DataBinding accepts as a data source either an IList or an
IListSource"

I use the following code for this reader:
Public Shared Function ReadAllExisting Reader() As
OracleClient.Or acleDataReader
Dim sqlCommand As String = "SELECT * FROM THTEST"

' DataSet that will hold the returned results

Dim pReader As OracleClient.Or acleDataReader
Dim db As Database = DatabaseFactory .CreateDatabase ()
Dim pOraConnection As OracleClient.Or acleConnection
pOraConnection = CType(db.GetCon nection(),
OracleClient.Or acleConnection)
Dim comm As OracleClient.Or acleCommand = New
OracleClient.Or acleCommand(sql Command, pOraConnection)

Try
pOraConnection. Open()
pReader =
comm.ExecuteRea der(CommandBeha vior.CloseConne ction)

Catch ex As Exception

Throw New Exception(ex.Me ssage)
Finally

End Try

Return pReader
End Function

And this is bound this way:
Dim reader As System.Data.Ora cleClient.Oracl eDataReader =
DAL.THTest.Read AllExistingRead er

.........
With Me.grdTHTest
.RowHeadersVisi ble = False
.DataSource = reader
.CaptionText = "TH Test"
.ReadOnly = True
End With

Anyone has a solution?

Jan 18 '06 #2
Hi,

"gillcleeren@go ogle mail DOT com" <gi*********@gm ail.com> wrote in message
news:11******** ************@o1 3g2000cwo.googl egroups.com...
I have a datagrid that has to be filled in a WinForms application. The
data comes from an Oracle database.

The normal procedure would be filling a dataset, but I have the problem
that there are over 100.000 records in the tables, so this has very low
performance when executing.


You need to retrieve only those records that you are going to use, depending
of how your records are organized you can create a SP that returns N records
with IDs less than/greater than a particular ID that represent the top
record.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 18 '06 #3
Do you mean some kind of grid paging like in ASP.net?

Do you have an example on how this works in winforms?

Thanks

gill

Jan 18 '06 #4
Hi,

"gillcleeren@go ogle mail DOT com" <gi*********@gm ail.com> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.com...
Do you mean some kind of grid paging like in ASP.net?

Do you have an example on how this works in winforms?

Thanks


Well, I did it in ASP.NET but the idea is the same, you have your grid, two
buttons "next" "previous" and depending of which you click you go one page
down/one page up
yuo just bind the grid in each situation

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 18 '06 #5

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

Similar topics

1
6393
by: Jim Ptak via .NET 247 | last post by:
I am desperate for help. I am at a loss. I have a dataset with 4columns in it. The first column is an actual column from adatabase table. The last three columns are hard codded values of0. I am using this dataset to populate a datagrid. The datagridhas a datagridtablestyle that has all four columns with the lastthree being DataGridBoolColumn's. This works great when I hit aSQL Server database. When I hit an Oracle database thecheckboxes are...
1
2203
by: Krzysztof Karnicki | last post by:
I have such a problem… I have create my custom DataGridColumn inheriting from System.Windows.Forms.DataGridColumnStyle on using it on DataGrid, to show rows painted by me self. Because dates taken from database are very large, and filling DataSet bounded to this DataGrid takes some time, a decided to put fill logic into new thread. And so method running in this thread clears only this DataSet bounded to DataGrid and fills it once more...
2
1305
by: tshad | last post by:
I have a datagrid that has objects that are not visible and I need to use them in my Sql Statement. The problem is they are not there when set as "visible=false", but they are if set to true. For example: I have: *****************************************************************************************
1
2116
by: thegame | last post by:
Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls Hello, I have an interesting dilemma. I have an ASPX page with two user controls (two ASCXs). Both ASCXs have DataGrids on them. The first user control's DataGrid is populated from our database on page load. The DataGrid also has a Select LinkButton.
2
2265
by: Parveen | last post by:
When I fill the same dataset table with new information from the database, instead of writing over any previous data, the fill method appends to existing records in this dataset table. Is there a way by which I can overwrite existing data in the dataset instead of appending to it? Thanks, Parveen
1
1323
by: reidarT | last post by:
I want to fill a datagrid with different dataadapters. The problem is to refresh the datagrid. How do I populate the datagrid with different dataadapters? I use buttons to do this button1 Private Sub cmdAnsatt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAnsatt.Click OleDbDAAnsatt.Fill(DsAnsatt) 'Me.Refresh() End Sub
0
1111
by: Tony A. | last post by:
I'm using VB 2005 with MS Access for as the database. I have a table (tblItem) that has two columns, ItemNum (key field) and ItemDescription. I also have a second table (tblOrdersDetail), this table has two columns ItemNum and ItemDescription Using a Datagrid View that is bound to the tblOrdersDetail table. When a users enters a number in the ItemNum column of the datagrid view I'd like the ItemDescription column of the datagrid view...
1
1590
by: WayneM | last post by:
I have compact framework app that I was trying to test out on a windows form, but I cannot get past the very first step of simply filling a DataGrid from a DataSet. My code is Dim sqlStmt As String = "Select VendorName, StartWeek from InventorySchedule Where FinishDate is Null and StartWeek<'" & Now & "'" Dim cmdDB As New SqlCommand(sqlStmt, connDB) Dim dgridTarget As New DataGrid Dim adapter As New SqlDataAdapter() Dim ds As New...
8
3071
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report reflect the values they anticipate committing to see hypothetical totals of columns from a set of records. These records are displaying properly on my DataGrid but I'm not sure how to get Crystal Reports 10 to use as its datasource the dataset...
0
8465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8803
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8587
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7407
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6210
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1787
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.