473,623 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

oledb and FindBy[ColumnName] for DataGrids

While attempting to migrate from my old "loop through all records" mindset with ADO 3.0 and into the ADO.NET arena, I've come across an issue using DataGrids with the OLEDB and Oracle data connection objects.

I began using the C# MSDN article (http://msdn.microsoft.com/library/de...dWriteData.asp) on DataGrid web controls and was very successful until...

-- Code --
dsCategories.Ca tegoriesRow r;
r = dsCategories1.C ategories.FindB yCategoryID(int .Parse(key));
-- /Code --

It appears that the second line, the "FindBy[ColumnName]" doesn't exist for any connection object except Sql (at least that was the only one that it appeared on). My applications will require a mix of SQL, Oracle, and other OLEDB compliant data sources--is there a better way than the MSDN article to determine the edited row of a DataGrid for Updating? I've Googled many responses; however, most everything I can find is dramatically different than the MSDN architecture; focusing on instantiating the objects dynamically in the code rather than through the GUI--and I'm not quiet to the comfort level to translate the code.

Thanks in advance!

-David


--------------------------------------------------------------------------
David R. Longnecker
CCNA, MCSA, Network+, A+
Management Information Services
Wichita Public Schools, USD 259


Nov 17 '05 #1
2 2960
David,

I'm not exactly sure what you are trying to do. However, it appears that you are trying to get the changes on a data set (or the current row).

What you could do is take the data source (the DataTable), and call the GetChanges method on it. This will return a DataTable populated with rows that represent the rows that have been changed.

You could also get the currently edited row by going through the BindingContext. If you pass the data source that you populated the data grid with (it's important that the data source and data member match EXACTLY in this case), it will return to you a CurrencyManager . From there, you can call the Current property, and cast that to a DataRowView, which will represent the current row being edited.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"David R. Longnecker" <dl*********@co mmunity.nospam> wrote in message news:Ow******** ******@tk2msftn gp13.phx.gbl...
While attempting to migrate from my old "loop through all records" mindset with ADO 3.0 and into the ADO.NET arena, I've come across an issue using DataGrids with the OLEDB and Oracle data connection objects.

I began using the C# MSDN article (http://msdn.microsoft.com/library/de...dWriteData.asp) on DataGrid web controls and was very successful until...

-- Code --
dsCategories.Ca tegoriesRow r;
r = dsCategories1.C ategories.FindB yCategoryID(int .Parse(key));
-- /Code --

It appears that the second line, the "FindBy[ColumnName]" doesn't exist for any connection object except Sql (at least that was the only one that it appeared on). My applications will require a mix of SQL, Oracle, and other OLEDB compliant data sources--is there a better way than the MSDN article to determine the edited row of a DataGrid for Updating? I've Googled many responses; however, most everything I can find is dramatically different than the MSDN architecture; focusing on instantiating the objects dynamically in the code rather than through the GUI--and I'm not quiet to the comfort level to translate the code.

Thanks in advance!

-David

------------------------------------------------------------------------
David R. Longnecker
CCNA, MCSA, Network+, A+
Management Information Services
Wichita Public Schools, USD 259


Nov 17 '05 #2
Hi David,

FindByCategoryI D was generated by the DataSet designer. When a column is
the Primary Key in a table, a FindByColumnNam e method will be automatically
generated. It seems in this article, a typed DataSet is used. You have to
create the typed DataSet according to you needs.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #3

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

Similar topics

1
5820
by: Francis | last post by:
Hello, My question is: is it better to use DataSets than the simple ExecuteNonQuery() methods. I thought the DataSets would be a better structured way of programming, but it seems to result in very lengthy code with a lot of frustration during debugging. This is my case:
2
1604
by: ddaniel | last post by:
I have read many posts and seen many papers on the different techniques for sort and filtering datagrids. Many do re-queries against the dB ala Fritz Onion. I am trying to leverage the Dataview. The following control simply responds to a sort request and/or a pageing reqeust with an empty table (header only). Any ideas ? Code behind : namespace OakTree.data {
0
933
by: sJeev via DotNetMonster.com | last post by:
Please help, I am very new to asp.net and data grids have got me stuck for a loooong time. I can either have the right content in my datagrids or make them editable. In the first case, I make the connection, the adapter, the dataset all in the aspx.cs file. I also make the oledb command there, and it works fine...until I try to edit it. The datagrid I make uses the tool under webforms in the aspx file. I think its because everything...
3
8917
by: Conrad F | last post by:
Hello All, I know how to import a specific named excel sheet into a datagrid using ADO.NET by setting up a JET connection and then SELECTing data from the sheet. However, for a real world application, I would typically not know what the names of the sheets are going to be before I open the Excel file. I am wondering if there is a SELECT statement that would get me the list of sheet names so that I can place them in a combobox and
1
2020
by: mursyidatun ismail | last post by:
Dear all, database use: Ms Access. platform: .Net i'm trying to update a record/records in a table called t_doctors by clicking da edit link provided in the database. when i ran through da browsers and click update it gave me this error: Specified argument was out of the range of valid values. Parameter name:
4
1170
by: mark | last post by:
(windows app not web) I have a procedure to populate a given datagrid (Datagrid1) with a dataset from an indexed data connection. It works: Globals: Dim FileName1 As String Dim DS As System.Data.DataSet Dim OleDbConnection1(20) As System.Data.OleDb.OleDbConnection Dim OleDbDataAdapter1(20) As System.Data.OleDb.OleDbDataAdapter Dim CurrentIndex As Integer = 0
5
2159
by: explode | last post by:
I made a procedure Public Sub Novo(ByVal nova1 As String, ByVal nova2 As String) that creates a new oledbDataAdapter with insert update select and delete commads. I also added that commands can change depending how many columns are in a Table. I add a new column with this code: Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Try...
0
1070
by: Jim | last post by:
OK here's my disclaimer: I'm very new to ASP.NET and posting on Google Groups, so please bear with me and feel free to correct either the way I code or the way I post. I have an ASP.NET page that is driven off of a dynamic dropdownlist control. In the page_load sub, I make the DB connection and fill the list based on a table of employees. Once an employee is selected, there are various datagrids below that are populated based on that...
0
3010
rhitam30111985
by: rhitam30111985 | last post by:
Hi all, I am using oledb to read values from an excel file as follows : Dataset DS = new Dataset(); OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM where UrlID=" + Somevalue , objConn);
0
8217
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
8661
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8603
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
8312
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
7132
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...
0
4067
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1467
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.