473,563 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CacheManager Fails to Save DataColumn DataType Change

Hi All,

I am using Microsoft.Appli cationBlocks.Ca che.CacheManage r to persist a
System.Data.Dat aset 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.TableN ame = "New Table";

newTable.Column s[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 (SomeSQLSelectS tring);
foreach(DataRow oldRow in selectedRow)
{
newRow = newTable.NewRow ();
newRow.ItemArra y = oldRow.ItemArra y;
newTable.Rows.A dd(newRow);
}

// Add to DataSet
ds.Tables.Add(n ewTable);

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

CacheManager.Ge tCacheManager() .Add("NewDataSe tKey", ds);

// Retreive DataSet from Cache
DataSet dsIncorrectColu mnType =
CacheManager.Ge tCacheManager() .GetData("NewDa taSetKey");

// Fails
Debug.Assert(ds IncorrectColumn Type.Tables["New
Table"].Columns[0].DataType = System.Int64);

</code>

Regards,
Brig R. Lamoreaux

Oct 19 '05 #1
0 1672

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

Similar topics

1
3421
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 change this from a boolean to a string, so that I may manipulate the output to read "X" instead of true, and "" for false. If I attempt to change the...
0
1015
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 dt As New DataTable
5
8061
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 reset the detail table autoincrement column to start from 1. I set the dataColumn AutoIncrementSeed=0 and AutoIncrementStep=1 each time i append a...
0
917
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 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...
1
13937
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
21866
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 another datetime column in the table. See sample below. How do I do this? Any help would be greatly appreciated. Thanks Private Sub...
3
6191
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 = System.Type.GetType"System.Boolean"); //"System.Boolean"); tia
3
24671
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 DataTable. Anyone can help me?
0
4521
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 columns to make a derived column. When I run my code, I get this error: ------------
0
7659
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.