Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dataset Row

Status
Not open for further replies.

9727604

Programmer
Jul 18, 2003
23
0
0
CA
Hi all,
I am using a pl/sql ref cursor to read a table from a database(oracle 9i) into a Dataset. What I want to do is somehow hash each row in the table and store the digest in a security column at the end of each row. The digest can then be checked to make sure no changes have been made to the data. Is there any way of returning a string representation of a whole row in a dataset so that it an be passed to the hash function or can anyone think of a better way to implement a data integrity check. Thank you
 
It appears as though you are wanting to validate this at the DataSet level, and not the DataSource. Can you not just check with the following: If( ds.HasChanges(DataRowState.Modified) == True)
 
What I want to implement is a security check to check the integrity of the data in the database. I want to ensure that if someone got access to the database and changed some of the information in a table then I would know. Basically i'm implementing a keyed hash function. I want to hash the row with a key and store the digest. If anyone then changes any data the recomputed digest would not match the stored digest. I would have thought that returning a row in string format would be a basic operation, however I am new to C# so maybe this is not the case
 
OK. So this is at the database level. Meaning if someone changed the data through any means--not only your program--you are looking for a way to get that information in your program?

I think what you are looking for is something similar to the classic ADO .GetString function.

Well, a DataRow will have an .ItemArray() function. You can look through the array and concatenate each element to a string.

 
I decided to use a stored procedure to solve my problem. I concatenated the strings using the pl/sql CONCAT function. I tried this method and it works. The only thing is you can only use CONCAT with two strings at a time which is a bit of a balls and can get real tricky when the table contains a lot of columns(mine has 18), you just have to watch your brackets

Code:
SELECT CONCAT(CONCAT(CONCAT( field1, field2), field3 ), field4) FROM table WHERE...

This way, the database returns just one field with all the field-values in one return-value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top