Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 23rd, 2004, 08:50 AM
Registered User
 
Join Date: Sep 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dataset in a Cooke

Hi Xperts,
How can I store and later retrieve a dataset to and from a Cookie?I am using ASP.Net 1.0...
I need to create a cookie for the shopping acrt application that I am currently working on. It is always easier to use the dataset for the cart, but I need to combine the both, a requirement u can say.
Any help is appreciated.
Thx in advance.

 
Old September 23rd, 2004, 09:13 AM
Authorized User
 
Join Date: Jul 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cookies are limited in size. Around 4k. Using a DataSet for a shopping cart is certainly convenient but overkill. You probably need a custom OrderItem list that you can serialize as a string. For instance, your OrderItem may have an ID,Quantity. You can override the ToString() to return "123:1" which is 1 of item 123. You can then have a collection of OrderItem and stick this in the cookie.Value property. What you want is lean and mean...
This is just one solution. Your cookie will look like this
"123:1456:2:34324:2" (3 OrderItems). Your can then parse this back to OrderItems easily when you read the cookie.



 
Old September 23rd, 2004, 12:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

You can use an alternative like the Session or Cache to store information in.

Brian
 
Old September 23rd, 2004, 11:16 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

try using Isolated Storage

Regards
Ganesh
 
Old September 24th, 2004, 02:04 AM
Authorized User
 
Join Date: Sep 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to someshtrivedi
Default

hi,
You can probably use session to store it, but it will definately take up more resources of ur server, so its better u convert the dataset to xml ie serialize it and then store the xml in a hidden variable or the viewstate and then retrieve it when required.
regards
Somesh






Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill a DataSet from another DataSet kamranzafar C# 1 February 7th, 2007 11:14 AM
Fill(dataset) or dataset.load() salemkoten SQL Server 2005 1 November 2nd, 2006 11:04 PM
Converting a untyped dataset to a typed dataset daphnean Visual Studio 2005 0 July 13th, 2006 01:16 AM
Copy dataset to another dataset kapila VB.NET 2 November 13th, 2005 06:25 AM
Re: SQL Server dataset to ACCESS dataset dazzer ADO.NET 0 March 22nd, 2004 05:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.