473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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
process.

<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
System.Int64.

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

// Add to DataSet
ds.Tables.Add(newTable);

// 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
Debug.Assert(dsIncorrectColumnType.Tables["New
Table"].Columns[0].DataType = System.Int64);

</code>

Regards,
Brig R. Lamoreaux

Nov 22 '05 #1
0 914

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: SoYouKnowBrig | last post by:
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...
3
by: J | last post by:
Is there anyway to format a calculated datacolumn? I would like the following column to display as money (formatted as $#,##0.00). Or how about simply displaying the column formatted as a number...
1
by: John E. | last post by:
I have a datagrid with one column that is boolean (it is a checkbox column). So that myDataTable.Column..DataType.UnderlyingSystemType == System.Boolean. For printing purposes, I would like to...
0
by: tnks | last post by:
Hello i need to save a virtual table (dataset table) into a SQL table somo one know how to do it ?? (this is part of my code) Dim sqladapt As SqlDataAdapter Dim dsOC As New DataSet Dim...
5
by: JC Voon | last post by:
Hi: How to reset the autoincrement value generated by DataTable ? I've master and detail table, the detail table has a autoincrement column, each time i add a new master record, i need to...
1
by: Jay Balapa | last post by:
Hello, Iam trying to do the following- if(myColumn.DataType==typeof(bool)) { } this does not work either Type.GetType("System.Boolean") instead of typeof(bool).
11
by: Matt F | last post by:
I'm trying to do something that seems like it should be pretty simple, but haven't found a solution. I am trying to add a datacolumn to a datatable that adds or subtracts a number of days based on...
3
by: DaveP | last post by:
im Trying to set a Datacolumn type for a new table boolean is not working, What is the correct waty //column.DataType = System.Type.GetType"System.Data.SqlTypes.SqlBoolean"); column.DataType...
3
by: Manuel | last post by:
Hi to all, I'm trying to copy a Datacolumn from a table to another, but with this code: destTable.Columns.Add(srcTable.Column); I got this error: Column 'colname' already belongs to another...
0
by: SMH | last post by:
Hi All, I am currently learning .Net 2, studying for 70-528. I've hit a bit of a brick wall with DataColumn.Expression. As I understand it, this can be used to (For example) concatenate two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.