|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ADO2 "Rows" questionIn ADO2, how would I find the position of "x" in:
myDataSet.Tables("myTable").Rows(x).Item("myField") = "NewValue" I want to manipulate some data in the current row in my dataset, but it seems that I have to know the index of the row that my dataset is at. How do I find the index of the current row? Hi phonl,
Actually, you needn't get the position of it. If you already have the BindingSource object, the BindingSource.Current property returns the current DataRow object. Manipulate on that object to set the new value. If you really need to get the position, BindingSource.Position property will do the trick. Hope that helps. Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights." Thank you Kevin; that works great. I used the DataRowView object of
BindingSource.Current. Another question on this topic; If I decided not to use the BindingSource and just go with a TableAdaper and DataSet, is there a way to know the position of x? myDataSet.Tables("myTable").Rows(x).Item("myField") = "NewValue" Show quoteHide quote "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message news:8KYqAzITGHA.4824@TK2MSFTNGXA03.phx.gbl... > Hi phonl, > > Actually, you needn't get the position of it. If you already have the > BindingSource object, the BindingSource.Current property returns the > current DataRow object. Manipulate on that object to set the new value. If > you really need to get the position, BindingSource.Position property will > do the trick. > > Hope that helps. > > Kevin Yu > ======= > "This posting is provided "AS IS" with no warranties, and confers no > rights." > Thank you Kevin; that works great. I used the DataRowView object of
BindingSource.Current. Another question on this topic; If I decided not to use the BindingSource and just go with a DataAdaper and DataSet, is there a way to know the position of x? myDataSet.Tables("myTable").Rows(x).Item("myField") = "NewValue" Show quoteHide quote "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message news:8KYqAzITGHA.4824@TK2MSFTNGXA03.phx.gbl... > Hi phonl, > > Actually, you needn't get the position of it. If you already have the > BindingSource object, the BindingSource.Current property returns the > current DataRow object. Manipulate on that object to set the new value. If > you really need to get the position, BindingSource.Position property will > do the trick. > > Hope that helps. > > Kevin Yu > ======= > "This posting is provided "AS IS" with no warranties, and confers no > rights." > Hi phonl,
Yes, you can still get that current row with CurrencyManager. If you are binding the DataSet to a DataGrid like: dataGrid1.DataSource = DataSet1.Tables[0]; You can get the CurrencyManager like CurrencyManager cm = (CurrencyManager)dataGrid1.BindingContext[DataSet1.Tables[0]); cm.Current is that DataRowView object and cm.Position is the position of currencly selected row. Actually, BindingSource is getting that information from the CurrencyManager. HTH. Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights." Thanks again Kevin. I was able to make it work from your example.
Show quoteHide quote "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message news:iEzkw2XTGHA.5524@TK2MSFTNGXA03.phx.gbl... > Hi phonl, > > Yes, you can still get that current row with CurrencyManager. If you are > binding the DataSet to a DataGrid like: > > dataGrid1.DataSource = DataSet1.Tables[0]; > > You can get the CurrencyManager like > > CurrencyManager cm = > (CurrencyManager)dataGrid1.BindingContext[DataSet1.Tables[0]); > > cm.Current is that DataRowView object and cm.Position is the position of > currencly selected row. Actually, BindingSource is getting that > information > from the CurrencyManager. HTH. > > Kevin Yu > ======= > "This posting is provided "AS IS" with no warranties, and confers no > rights." > You're welcome.
Thanks for sharing your experience with all the people here. If you have any questions, please feel free to post them in the community. Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
COnverting CSV to XLS file
VB.NET Thread Garbage Collection easy one Property and type Problems with Quotes in SQL queries in VB.Net Windows Thumbnail Control Regular Expressions Problem string formatting Microsoft VBScript compilation error '800a0400' Where did this come from: Microsoft\CStoVBConverter\Samples\Smart Client\ |
|||||||||||||||||||||||