470,581 Members | 2,404 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,581 developers. It's quick & easy.

CacheManager Fails to Save DataColumn DataType Change

Hi All,

I am using Microsoft.ApplicationBlocks.Cache.CacheManager to persist a
System.Data.Dataset object. This Dataset object has a DataTable that is
created from an existing DataTable using the Clone() method. Before I
add the new DataTable to the DataSet, I change the DataType of a
DataColumn from System.String to System.Int64. I then add data to the
new table and then add it to the DataSet. Then DataSet is then added to
the Cache. However, when I retrieve the DataSet from the Cache, the
DataColumn whose DataType I changed, reverted back to System.String. Is
this a bug? Am I doing something wrong? Here is a sample of the code


DataSet ds = null;
DataTable oldTable = GetSomeTable();
DataTable newTable = oldTable.Clone();

newTable.TableName = "New Table";

newTable.Columns[0].DataType = System.Int64;
// Note: at this point the DataType has indeed been changed to

// Populate with data
DataRow newRow = null;
DataRow[] selectedRow = oldTable.Select(SomeSQLSelectString);
foreach(DataRow oldRow in selectedRow)
newRow = newTable.NewRow();
newRow.ItemArray = oldRow.ItemArray;

// Add to DataSet

// Checking again at this point, DataType is still System.Int64;

CacheManager.GetCacheManager().Add("NewDataSetKey" , ds);

// Retreive DataSet from Cache
DataSet dsIncorrectColumnType =
CacheManager.GetCacheManager().GetData("NewDataSet Key");

// Fails
Table"].Columns[0].DataType = System.Int64);


Brig R. Lamoreaux

Nov 22 '05 #1
0 852

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by J | last post: by
5 posts views Thread by JC Voon | last post: by
1 post views Thread by Jay Balapa | last post: by
3 posts views Thread by DaveP | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.