Wrox Home  
Search P2P Archive for: Go

  Return to Index  

ado_dotnet thread: AW: RE: AW: RE: timestamp in c# question


Message #1 by "ProDevTeam" <ProDevTeam@g...> on Mon, 10 Feb 2003 09:55:24 +0100
Sorry, your right I mean optimistic concurrency.
And I have found my error. If I don=B4t close the ado connection I get
always the same value for the timestamp column. When I close the
connection after the update command and make a new select, than I get
the new timestamp column value. It seems that ado stores the data
temporary when the connection is open.

thanx for your help

Bj=F6rn

-----Urspr=FCngliche Nachricht-----
Von: Brian Smith [mailto:bsmith@l...]
Gesendet: Freitag, 7. Februar 2003 17:08
An: ADO.NET
Betreff: [ado_dotnet] RE: AW: RE: timestamp in c# question


Hmmm, some confusion here. Timestamp columns are usually provided to
implement optimistic concurrency, and you never need to access their
value - just send the original value back to the server in an update.

So why do you want to extract the 'value' (which I think is correctly
transformed to a byte array, as its actually a varbinary(8))?

See
http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=3D454

brian

-----Original Message-----
From: ProDevTeam [mailto:ProDevTeam@g...]
Sent: Fri, 07 Feb 2003 13:44
To: ADO.NET
Subject: [ado_dotnet] AW: RE: timestamp in c# question


Hi Brian

Thanx for your answer.

First, I need the timestamp column because I=B4m working on a multi-user
application. I must use "pessimistic concurrency" so timestamp is the
data type I have to deal with.

If I use "string sqlValue =3D
DataSet.Tables["myTable"].Rows[myRow]["myColumn"].ToString()"
 the string "sqlValue" is automatic converted in a byte Array. And this
byte array has always the same value even if I run an update statement
against my DB. I have tried to cast it to datatype "SqlBinary" but I get
an exception(specified cast is not valid)"SqlBinary testSql =3D
((System.Data.SqlTypes.SqlBinary)myRow[myColumn])"

Any ideas???

regards Bj=F6rn

-----Urspr=FCngliche Nachricht-----
Von: Brian Smith [mailto:bsmith@l...]
Gesendet: Freitag, 7. Februar 2003 13:18
An: ADO.NET
Betreff: [ado_dotnet] RE: timestamp in c# question


A timestamp column is not intended for interpretation - it's a long
number based on the time, and guaranteed unique by the server. If you
want to treat it as time, then use a datetime column. Unless you have a
very high transaction rate, this will perform the same function with
addition of giving useful information.

As for your iteration, it looks enormously exensive if all it does is
identify a single column value: what's wrong with
DataSet.Tables["myTable"].Rows[myRow]["myColumn"]?

brian

-----Original Message-----
From: ProDevTeam [mailto:ProDevTeam@g...]
Sent: Fri, 07 Feb 2003 10:43
To: ADO.NET
Subject: [ado_dotnet] timestamp in c# question


Hi Group

To make sure I get no "lost updates/concurrency problem" in my DB when I
update data, I have added a timestamp column to each table. Now I want
to work with this timestamp column in my C# source code. To do that I
have a method which connects to the DB and returns a filled dataset. Now
I want to exctract the timestamp column out of the dataset. But I 
don=B4t
know how to exactly do this. For simple datatypes (string,int...) I have
a method which returns the result as string

------cut---------------------------
foreach(DataTable myTables in DataSet.Tables)
{
 foreach(DataRow myRow in myTables.Rows)
 {
  foreach (DataColumn myColumn in myTables.Columns)
  {
   if(columnname =3D=3D myColumn.ToString().ToLower())
   {
    valueFound =3D myRow[myColumn].ToString();
   }
  }
 }
}

-------------cut--------------------------------------

When I use this method my string is converted in a byte array. But the
byte array is always the same, even if i run an update against the
selected data. My problem is I don=B4t know/ find another way to get the
data out of the dataset. Can anyone help me?

regards

Bj=F6rn

=3D=3D=3D
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed
DataSets, accessing data using DataReaders and DataAdaptors, the close
relationship between ADO.NET and XML, how and where to use ADO.NET in
your enterprise applications, and how to use Web Services and ADO.NET to
easily pass data between applications.
http://www.wrox.com/books/1861007604.htm

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003



=3D=3D=3D
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed
DataSets, accessing data using DataReaders and DataAdaptors, the close
relationship between ADO.NET and XML, how and where to use ADO.NET in
your enterprise applications, and how to use Web Services and ADO.NET to
easily pass data between applications.
http://www.wrox.com/books/1861007604.htm




=3D=3D=3D
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed
DataSets, accessing data using DataReaders and DataAdaptors, the close
relationship between ADO.NET and XML, how and where to use ADO.NET in
your enterprise applications, and how to use Web Services and ADO.NET to
easily pass data between applications.
http://www.wrox.com/books/1861007604.htm

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003



=3D=3D=3D
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed
DataSets, accessing data using DataReaders and DataAdaptors, the close
relationship between ADO.NET and XML, how and where to use ADO.NET in
your enterprise applications, and how to use Web Services and ADO.NET to
easily pass data between applications.
http://www.wrox.com/books/1861007604.htm




  Return to Index