Yes, i know there is no record, but a row is still a
record. tables have records. but im familiar with some
of the lingo.. anyway. there is no reference to a set
position, however there is a position method..(i believe)
that allows you to navigate. maybe im in the wrong forum??
ADO.NET uses dataadapters and datasets. (i thought) im
using oledbdatasets and adapters. Datasets have
a .position method. that is how you navigate. that is how
the data form wizard code is generated. thats what i
copied for my form that im having issues with.
all i can say is the only code i have in the program is
the navigation code. and as soon as i navigate to another
row, the haschanged.modified = true. i cant understand
this.
i use the dataadpter.fill(dataset, datamember) 'to fill
the dataset.
then i use a position command to set the current dataset
row to 0.
this is where the haschanged becomes true.
There is no "HasChanged.Modified" to check. You must mean:
DataSet.HasChanges(DataRowState.Modified) is returning true.
All that means is that at least one record has changed in the DataSet,
not the "Current" row. As I have said already, THERE IS NO CURRENT ROW.
Stop assuming that HasChanges() is limited to the state of a (non-
existant) "current" row.
There is no Position property on a DataSet or DataTable or DataAdapter.
Take a look at the help files.
However, BindingManagerBase does have a Position property.
CurrencyManager derives from BindingManagerBase, and thus also has a
Position property. Nothing else in the System.Data namespace has a
Position property (according to the help files index).
The Position property returns an integer, not a DataRow. But you can use
that Position to get the DataRow with that index in the DataRowCollection
of your DataTable (Rows property). Once you have a reference to that
DataRow, then query it's RowState property.
There is no "OleDbDataSet" Each provider has the following classes:
"PrvConnection", "PrvCommand", "PrvParameter", "PrvDataAdapter",
"PrvTransaction", and "PrvParameterCollection".
DataSet, DataTable, DataRow, DataRowState are all database provider
independant classes / enums.
Here is how to use the CurrencyManager to get the current DataRow
selected in a DataGrid:
============================================================
given:
"DataGrid dgCustomers;" on the form
CurrencyManager cm;
cm = (CurrencyManager)dgCustomers.BindingContext[
dgCustomers.DataSource, dgCustomers.DataMember];
//get the DataRow referenced by the current row in the grid:
DataRow dr = ((DataRowView)cm.Current).Row;
============================================================
Hope this helps.
Please read the help files I have mentioned, and try my suggestion before
you respond with more untrue statements.
--
Michael Lang, MCSD
See my .NET open source projects
http://sourceforge.net/projects/colcodegen (simple code generator)
http://sourceforge.net/projects/dbobjecter (database app code generator)
http://sourceforge.net/projects/genadonet ("generic" ADO.NET)