pendragon Posted July 26, 2004 Posted July 26, 2004 What I am trying to do is pass a row to a routine and make an update command that just contains the ammended columns. Problem Is I don't seem to be able to find a way off going through the rows columns collection to see if the current value is different to the original value, and if so then to get the columns name. Does any one know how to do this or how to just get the column name returned. Thanks Quote
JABE Posted July 26, 2004 Posted July 26, 2004 DataRow.Item has an overload where you can specify DataRowVersion as the second parameter. Read up DataRow.HasVersion sample code in MSDN lib. Quote
pendragon Posted July 26, 2004 Author Posted July 26, 2004 JABE Thanks for the reply. I know about the DataRowVersion in DataRow.Item, the only problem with this is that it needs the Column name and I don't know it as I will be sending it lots of different tables. Quote
Joe Mamma Posted July 26, 2004 Posted July 26, 2004 JABE Thanks for the reply. I know about the DataRowVersion in DataRow.Item, the only problem with this is that it needs the Column name and I don't know it as I will be sending it lots of different tables. I am wondering if this is something you want to do in the client application as opposed to a server side trigger on the table being updated. I have found that when things are not easy to do in .NET, usually the reason is that its not the most efficient way to do it. I know in sql server, getting this info is very easy in a trigger. Comments??? Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
JABE Posted July 27, 2004 Posted July 27, 2004 I know about the DataRowVersion in DataRow.Item, the only problem with this is that it needs the Column name and I don't know it as I will be sending it lots of different tables. DataRow.Item can work w/ a column index as well, not just w/ a column name. Try re-reading the overload versions. Quote
pendragon Posted July 27, 2004 Author Posted July 27, 2004 I don't think I have explaned what it is I am trying to do very well so I will go into more detail. First the database I am connecting to is in Access 2000. What I am hoping to do is to have a routine that will take a DataRow as a parameter. It will then look at all rows to see which have changed, if a row has changed get the row name and append it to a string to create an updatecommand that it will send back to the calling program. JABE Thanks for your reply, Yes you are right and I did actual know this, but for some reason I had trouble saying what I meant yesterday. :D I should have added that I was unsure how to go through the index as I didn't know how many columns there were. I have since found row.Table.Columns.Count that I believe will do what I want, So Yes, I can use the DataRow as you suggested to find out which columns have changed but I don't seem to be able to find a way to get the column name. Joe Mamma Thanks for your reply, I must admit that I don't actual know what triggers are as I have never used SQL Server, We have Novel here and I don't remember seeing them mentioned. Quote
pendragon Posted July 27, 2004 Author Posted July 27, 2004 :rolleyes: Pennys Droped row.Table.Columns[0].ColumnName I think I will just forget everything I tried to do yesterday Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.