473,698 Members | 2,132 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

Nov 22 '05 #1
0 922

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

Similar topics

0
1686
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 add data to the new table and then add it to the DataSet. Then DataSet is then added to the Cache....
3
18715
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 with only 2 decimals (#,##0.00)? In the sample below, amount and taxrate are existing DataColumn's. DataColumn colTax = new DataColumn(); colTax.DataType = System.Type.GetType("System.String"); colTax.ColumnName = "tax";...
1
3430
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 DataColumn type currently, I get an error stating that I cannot change the type of a column when...
0
1024
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
8077
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 new master row, but it seem not work, it still remain
1
13977
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
21897
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 CreateDataTable() dt = New DataTable
3
6201
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
24681
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
4557
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
8672
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4361
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1998
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.