How do you make use of the generated ROW classes?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
betawarz
Posts: 10
Joined: Mon 06 Dec 2010 18:15

How do you make use of the generated ROW classes?

Post by betawarz » Mon 06 Dec 2010 18:24

Hi all,

I'm using the dotConnect for Oracle drivers in my C# application. I've got my Table Adapter working, and executing a custom query of mine. I'm able to see the results, in code, by looping over the Rows DataRowCollection object.

But, I see that there is a provided Row class - in my case USERSRow. I'm trying to figure out how to use this class with the results from the query. This would be nice so I can reference the columns by property name rather than an obscure index value in the DataRowCollection array.

How do I make use of this class? Here's my small chunk of code. Thanks in advance!

Code: Select all

            // Perform the query
            USERSTableAdapter usersAdapter = new USERSTableAdapter();
            DataArchive.USERSDataTable usersTable = usersAdapter.GetData(this.Username.Text, this.Password.Text);

            if (usersTable.Rows.Count == 1)
            {
                // Successfull login attempt
            }

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 08 Dec 2010 12:57

usersTable.Rows returns DataRowCollection, and you can refer to DataRowCollection's items (DataRows) via indexer: usersTable.Rows[i] where i is a number of a DataRow in this collection. When you have got a particular row, you can reference the needed column via its index or column name: usersTable.Rows["COLUMN_NAME_IN_TABLE_USERS"].
MSDN: http://msdn.microsoft.com/en-us/library ... .rows.aspx.

Code: Select all

            // Perform the query
            USERSTableAdapter usersAdapter = new USERSTableAdapter();
            DataArchive.USERSDataTable usersTable = usersAdapter.GetData(this.Username.Text, this.Password.Text);

            if (usersTable.Rows.Count > 0) {
                // Successfull login attempt
                for (int i = 0; i  Add New DataSource menu of Visual Studio) - standard way with TableAdapters classes;
2) Devart DataSet generation (the Tools > Oracle > DataSet Wizard menu of Visual Studio) - the way based on the extended capabilities of the [url=http://www.devart.com/dotconnect/oracle/docs/?Devart.Data.Oracle~Devart.Data.Oracle.OracleDataTable.html]OracleDataTable[/url] class (without TableAdapters classes): [url]http://www.devart.com/dotconnect/oracle/docs/?DataSets.html[/url].

Post Reply